Navigation Menu

Skip to content

Commit

Permalink
Use meaningful name
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 27, 2017
1 parent c56b006 commit da9f890
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/groonga/client/command-line/groonga-client-index-check.rb
Expand Up @@ -30,7 +30,7 @@ def initialize

def run(arguments)
parser = Parser.new
indexes = parser.parse(arguments) do |option_parser|
indexe_names = parser.parse(arguments) do |option_parser|
parse_command_line(option_parser)
end

Expand All @@ -39,7 +39,7 @@ def run(arguments)
end

parser.open_client do |client|
checker = Checker.new(client, @methods, indexes)
checker = Checker.new(client, @methods, indexe_names)
checker.run
end
end
Expand Down Expand Up @@ -69,10 +69,10 @@ def parse_command_line(parser)
end

class Checker < Runner
def initialize(client, methods, targets)
def initialize(client, methods, index_names)
super(client)
@methods = methods
@targets = targets
@index_names = index_names
end

private
Expand All @@ -85,11 +85,11 @@ def run_internal
end

def check_target_table?(table_name)
unless @targets.count > 0
unless @index_names.count > 0
return true
end
if @targets.kind_of?(Array)
@targets.each do |name|
if @index_names.kind_of?(Array)
@index_names.each do |name|
table_part = name.split(".").first
return true if table_name == table_part
end
Expand All @@ -98,15 +98,15 @@ def check_target_table?(table_name)
end

def check_target_column?(column)
unless @targets.count > 0
unless @index_names.count > 0
return column["type"] == "index"
else
unless column["type"] == "index"
return false
end
end
if @targets.kind_of?(Array)
@targets.each do |name|
if @index_names.kind_of?(Array)
@index_names.each do |name|
return true if name == "#{column['domain']}.#{column['name']}" or
name == column["domain"]
end
Expand Down Expand Up @@ -197,7 +197,7 @@ def check_content
end
end
if target_columns.empty?
abort_run("Failed to check <#{@targets.join(',')}> because there is no such a LEXCON.INDEX.")
abort_run("Failed to check <#{@index_names.join(',')}> because there is no such a LEXCON.INDEX.")
end
broken_indexes = []
target_columns.each do |column|
Expand Down

0 comments on commit da9f890

Please sign in to comment.