Class: Elasticband::Filter::Near
- Inherits:
-
Elasticband::Filter
- Object
- Elasticband::Filter
- Elasticband::Filter::Near
- Defined in:
- lib/elasticband/filter/near.rb
Constant Summary
Constants inherited from Elasticband::Filter
Instance Attribute Summary collapse
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#on ⇒ Object
Returns the value of attribute on.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Elasticband::Filter
Instance Method Summary collapse
-
#initialize(on: :location, latitude: nil, longitude: nil, distance: '100km', type: :arc) ⇒ Near
constructor
A new instance of Near.
- #to_h ⇒ Object
Methods inherited from Elasticband::Filter
Constructor Details
#initialize(on: :location, latitude: nil, longitude: nil, distance: '100km', type: :arc) ⇒ Near
Returns a new instance of Near.
6 7 8 9 10 11 12 |
# File 'lib/elasticband/filter/near.rb', line 6 def initialize(on: :location, latitude: nil, longitude: nil, distance: '100km', type: :arc) self.on = on self.latitude = latitude self.longitude = longitude self.distance = distance self.type = type end |
Instance Attribute Details
#distance ⇒ Object
Returns the value of attribute distance.
4 5 6 |
# File 'lib/elasticband/filter/near.rb', line 4 def distance @distance end |
#latitude ⇒ Object
Returns the value of attribute latitude.
4 5 6 |
# File 'lib/elasticband/filter/near.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
4 5 6 |
# File 'lib/elasticband/filter/near.rb', line 4 def longitude @longitude end |
#on ⇒ Object
Returns the value of attribute on.
4 5 6 |
# File 'lib/elasticband/filter/near.rb', line 4 def on @on end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/elasticband/filter/near.rb', line 4 def type @type end |
Instance Method Details
#to_h ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticband/filter/near.rb', line 14 def to_h { geo_distance: { on => { lat: latitude, lon: longitude }, distance: distance, distance_type: type } } end |