summaryrefslogtreecommitdiff
path: root/lib/chef_zero/solr
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2019-12-29 18:00:24 -0800
committerTim Smith <tsmith84@gmail.com>2019-12-29 18:00:24 -0800
commitecad8fee4a946b337e60a4274de2b2c872c9e81b (patch)
treebbf7fc8b3feae42007f7b9d7fe53648d315c410a /lib/chef_zero/solr
parenta8206d6c6f03de1fde15c49f6fe9ddb1d0071b7a (diff)
downloadchef-zero-ecad8fee4a946b337e60a4274de2b2c872c9e81b.tar.gz
Apply Chefstyle
Autocorrect with the latest chefstyle Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef_zero/solr')
-rw-r--r--lib/chef_zero/solr/query/phrase.rb2
-rw-r--r--lib/chef_zero/solr/query/range_query.rb6
-rw-r--r--lib/chef_zero/solr/solr_parser.rb10
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/chef_zero/solr/query/phrase.rb b/lib/chef_zero/solr/query/phrase.rb
index d345a8e..666b3c2 100644
--- a/lib/chef_zero/solr/query/phrase.rb
+++ b/lib/chef_zero/solr/query/phrase.rb
@@ -11,7 +11,7 @@ module ChefZero
else
literal_string = nil
end
- super(terms.map { |term| term.regexp_string }.join("#{NON_WORD_CHARACTER}+"), literal_string)
+ super(terms.map(&:regexp_string).join("#{NON_WORD_CHARACTER}+"), literal_string)
end
def to_s
diff --git a/lib/chef_zero/solr/query/range_query.rb b/lib/chef_zero/solr/query/range_query.rb
index 67ce1ce..7eed494 100644
--- a/lib/chef_zero/solr/query/range_query.rb
+++ b/lib/chef_zero/solr/query/range_query.rb
@@ -10,7 +10,7 @@ module ChefZero
end
def to_s
- "#{@from_inclusive ? '[' : '{'}#{@from} TO #{@to}#{@to_inclusive ? ']' : '}'}"
+ "#{@from_inclusive ? "[" : "{"}#{@from} TO #{@to}#{@to_inclusive ? "]" : "}"}"
end
def matches_values?(values)
@@ -20,7 +20,7 @@ module ChefZero
when -1
return false
when 0
- return false if !@from_inclusive
+ return false unless @from_inclusive
end
end
unless @to == "*"
@@ -28,7 +28,7 @@ module ChefZero
when 1
return false
when 0
- return false if !@to_inclusive
+ return false unless @to_inclusive
end
end
return true
diff --git a/lib/chef_zero/solr/solr_parser.rb b/lib/chef_zero/solr/solr_parser.rb
index 86c232f..8de63e6 100644
--- a/lib/chef_zero/solr/solr_parser.rb
+++ b/lib/chef_zero/solr/solr_parser.rb
@@ -50,7 +50,7 @@ module ChefZero
if @query_string[@index] == '\\'
@index += 1
end
- @index += 1 if !eof?
+ @index += 1 unless eof?
break if eof? || !peek_term_token
end
@query_string[start_index..@index - 1]
@@ -66,6 +66,7 @@ module ChefZero
def peek_term_token
return nil if @query_string[@index] =~ /\s/
+
op = peek_operator_token
!op || op == "-"
end
@@ -79,6 +80,7 @@ module ChefZero
return result
end
end
+
nil
end
@@ -145,13 +147,13 @@ module ChefZero
# If it's the start of a range query, build that
elsif token == "{" || token == "["
left = next_token
- parse_error(left, "Expected left term in range query") if !left
+ parse_error(left, "Expected left term in range query") unless left
to = next_token
parse_error(left, "Expected TO in range query") if to != "TO"
right = next_token
- parse_error(right, "Expected left term in range query") if !right
+ parse_error(right, "Expected left term in range query") unless right
end_range = next_token
- parse_error(right, "Expected end range '#{end_range}") if !["}", "]"].include?(end_range)
+ parse_error(right, "Expected end range '#{end_range}") unless ["}", "]"].include?(end_range)
Query::RangeQuery.new(left, right, token == "[", end_range == "]")
elsif token == "("