Navigation Menu

Skip to content

Commit

Permalink
Remove needless FilterGeoInCircleParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 27, 2017
1 parent e746445 commit 4d08ec3
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions lib/groonga/client/request/select.rb
Expand Up @@ -256,11 +256,16 @@ def geo_in_circle(column_name_or_point,
center,
radius_or_point,
approximate_type="rectangle")
parameter = FilterGeoInCircleParameter.new(column_name_or_point,
center,
radius_or_point,
approximate_type)
add_parameter(FilterMerger, parameter)
expression = "geo_in_circle(%{column_name_or_point}"
expression << ", %{center}"
expression << ", %{radius_or_point}"
expression << ", %{approximate_type}"
expression << ")"
@request.filter(expression,
column_name_or_point: column_name_or_point,
center: center,
radius_or_point: radius_or_point,
approximate_type: approximate_type)
end

# Adds a `between` condition then return a new `select`
Expand Down Expand Up @@ -592,31 +597,6 @@ def initialize(expression, values)
end
end

# @private
class FilterGeoInCircleParameter
include ScriptSyntaxValueEscapable

def initialize(point,
center, radious,
approximate_type)
@point = point
@center = center
@radious = radious
@approximate_type = approximate_type
end

def to_parameters
filter = "geo_in_circle(#{escape_script_syntax_value(@point)}"
filter << ", #{escape_script_syntax_value(@center)}"
filter << ", #{escape_script_syntax_value(@radious)}"
filter << ", #{escape_script_syntax_value(@approximate_type)}"
filter << ")"
{
filter: filter,
}
end
end

class FilterBetweenParameter
include ScriptSyntaxValueEscapable

Expand Down

0 comments on commit 4d08ec3

Please sign in to comment.