Navigation Menu

Skip to content

Commit

Permalink
Use instance variable instead of Hash access
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 27, 2017
1 parent a4fa942 commit 9a817ce
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/groonga/client/command-line/groonga-client-index-check.rb
Expand Up @@ -43,7 +43,7 @@ def run(argv)
options = {
:check_missing_source => @check_missing_source,
:check_index_integrity => @check_index_integrity,
:target => targets
:targets => targets,
}
checker = Checker.new(client, options)
checker.check
Expand Down Expand Up @@ -100,6 +100,7 @@ class Checker
def initialize(client, options)
@client = client
@options = options
@targets = @options[:targets]
@exit_code = 0
end

Expand Down Expand Up @@ -154,11 +155,11 @@ def column_remove(table_name, column_name)
end

def check_target_table?(table_name)
unless @options[:target].count > 0
unless @targets.count > 0
return true
end
if @options[:target].kind_of?(Array)
@options[:target].each do |name|
if @targets.kind_of?(Array)
@targets.each do |name|
table_part = name.split(".").first
return true if table_name == table_part
end
Expand All @@ -167,15 +168,15 @@ def check_target_table?(table_name)
end

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

0 comments on commit 9a817ce

Please sign in to comment.