Class: FieldView::Feature
- Inherits:
-
Object
- Object
- FieldView::Feature
- Defined in:
- lib/fieldview/feature.rb
Instance Attribute Summary collapse
-
#coordinates ⇒ Object
Returns the value of attribute coordinates.
-
#data ⇒ Object
Returns the value of attribute data.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(json_feature_object) ⇒ Feature
constructor
A new instance of Feature.
- #multi_polygon? ⇒ Boolean
- #point? ⇒ Boolean
- #polygon? ⇒ Boolean
Constructor Details
#initialize(json_feature_object) ⇒ Feature
Returns a new instance of Feature.
5 6 7 8 9 10 |
# File 'lib/fieldview/feature.rb', line 5 def initialize(json_feature_object) # Use RGEO?? self.type = json_feature_object[:type] self.coordinates = json_feature_object[:coordinates] self.data = json_feature_object end |
Instance Attribute Details
#coordinates ⇒ Object
Returns the value of attribute coordinates.
3 4 5 |
# File 'lib/fieldview/feature.rb', line 3 def coordinates @coordinates end |
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/fieldview/feature.rb', line 3 def data @data end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/fieldview/feature.rb', line 3 def type @type end |
Instance Method Details
#multi_polygon? ⇒ Boolean
16 17 18 |
# File 'lib/fieldview/feature.rb', line 16 def multi_polygon?() return !!(self.type =~ /\Amultipolygon\z/i) end |
#point? ⇒ Boolean
12 13 14 |
# File 'lib/fieldview/feature.rb', line 12 def point?() return !!(self.type =~ /\Apoint\z/i) end |
#polygon? ⇒ Boolean
20 21 22 |
# File 'lib/fieldview/feature.rb', line 20 def polygon?() return !!(self.type =~ /\Apolygon\z/i) end |