Class: Eson::Search::GeoPolygon
- Inherits:
-
Object
- Object
- Eson::Search::GeoPolygon
- Includes:
- Filter
- Defined in:
- lib/eson/search/geo_polygon.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#geo_polygon { ... } ⇒ self
Generates a ‘geo_polygon` filter in a filter context.
-
#initialize(field, options = {}) ⇒ GeoPolygon
constructor
A new instance of GeoPolygon.
- #point(point) ⇒ Object
- #points(points = nil) ⇒ Object
- #to_query_hash ⇒ Object
Methods included from Filter
Constructor Details
#initialize(field, options = {}) ⇒ GeoPolygon
Returns a new instance of GeoPolygon.
10 11 12 13 |
# File 'lib/eson/search/geo_polygon.rb', line 10 def initialize(field, = {}) self.field = field self. = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Eson::Search::Filter
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
8 9 10 |
# File 'lib/eson/search/geo_polygon.rb', line 8 def field @field end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/eson/search/geo_polygon.rb', line 8 def @options end |
Instance Method Details
#geo_polygon { ... } ⇒ self
7 |
# File 'lib/eson/search/geo_polygon.rb', line 7 short_name :geo_polygon |
#point(point) ⇒ Object
23 24 25 |
# File 'lib/eson/search/geo_polygon.rb', line 23 def point(point) points << point end |
#points(points = nil) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/eson/search/geo_polygon.rb', line 15 def points(points = nil) if points @points = points else @points ||= [] end end |
#to_query_hash ⇒ Object
27 28 29 |
# File 'lib/eson/search/geo_polygon.rb', line 27 def to_query_hash { name => .merge({ field => {:points => points} }) } end |