Class: Shapefile::Shape
- Inherits:
-
Object
- Object
- Shapefile::Shape
- Defined in:
- lib/shapefile/shape.rb
Direct Known Subclasses
Defined Under Namespace
Classes: MultiPatch, MultiPoint, MultiPointM, MultiPointZ, Null, Point, PointM, PointZ, PolyLine, PolyLineM, PolyLineZ, Polygon, PolygonM, PolygonZ
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(id, raw_record) ⇒ Shape
constructor
:nodoc:.
Constructor Details
#initialize(id, raw_record) ⇒ Shape
:nodoc:
5 6 7 8 |
# File 'lib/shapefile/shape.rb', line 5 def initialize(id, raw_record) # :nodoc: @id = id self.attributes = {} end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/shapefile/shape.rb', line 3 def attributes @attributes end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/shapefile/shape.rb', line 2 def id @id end |
Class Method Details
.class_for_code(code) ⇒ Object
22 23 24 |
# File 'lib/shapefile/shape.rb', line 22 def self.class_for_code(code) @codes_classes[code] end |
.code ⇒ Object
18 19 20 |
# File 'lib/shapefile/shape.rb', line 18 def self.code nil end |
.enumerate_subclass_codes ⇒ Object
:nodoc:
10 11 12 13 14 15 16 |
# File 'lib/shapefile/shape.rb', line 10 def self.enumerate_subclass_codes # :nodoc: @codes_classes = {} constants.each do |const| subclass = eval("Shapefile::Shape::#{const}") rescue next @codes_classes[subclass.code] = subclass end end |
Instance Method Details
#[](key) ⇒ Object
26 27 28 |
# File 'lib/shapefile/shape.rb', line 26 def [](key) attributes[key] end |