Class: Arelastic::Queries::GeoShape::Polygon
- Inherits:
-
Query
- Object
- Nodes::Node
- Query
- Arelastic::Queries::GeoShape::Polygon
- Defined in:
- lib/arelastic/queries/geo_shape/polygon.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#options ⇒ Object
Returns the value of attribute options.
-
#points ⇒ Object
Returns the value of attribute points.
Instance Method Summary collapse
- #as_elastic ⇒ Object
-
#initialize(field, points, options = {}) ⇒ Polygon
constructor
A new instance of Polygon.
Methods inherited from Query
#has_child, #has_parent, #negate, #nested
Methods inherited from Nodes::Node
#==, #convert_to_elastic, #hash, #read_option!
Methods included from Arities::Binary
Methods included from Arities::Polyadic
Methods included from Arities::Unary
Constructor Details
#initialize(field, points, options = {}) ⇒ Polygon
Returns a new instance of Polygon.
9 10 11 12 13 |
# File 'lib/arelastic/queries/geo_shape/polygon.rb', line 9 def initialize(field, points, = {}) @field = field @points = points @options = end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
7 8 9 |
# File 'lib/arelastic/queries/geo_shape/polygon.rb', line 7 def field @field end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/arelastic/queries/geo_shape/polygon.rb', line 7 def @options end |
#points ⇒ Object
Returns the value of attribute points.
7 8 9 |
# File 'lib/arelastic/queries/geo_shape/polygon.rb', line 7 def points @points end |
Instance Method Details
#as_elastic ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/arelastic/queries/geo_shape/polygon.rb', line 15 def as_elastic params = { 'shape' => { 'type' => 'polygon', 'coordinates' => [points] }, 'relation' => 'within' }.update() { 'geo_shape' => { field => params } } end |