Class: RGeo::Shapefile::Reader::Record
- Inherits:
-
Object
- Object
- RGeo::Shapefile::Reader::Record
- Defined in:
- lib/rgeo/shapefile/reader.rb
Overview
Shapefile records are provided to the caller as objects of this type. The record includes the record index (0-based), the geometry (which may be nil if the shape type is the null type), and a hash of attributes from the associated dbf file.
You should not need to create objects of this type yourself.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
The attributes as a hash.
-
#geometry ⇒ Object
readonly
The geometry contained in this shapefile record.
-
#index ⇒ Object
readonly
The 0-based record number.
Instance Method Summary collapse
-
#[](key_) ⇒ Object
Returns the value for the given attribute key.
-
#initialize(index_, geometry_, attributes_) ⇒ Record
constructor
:nodoc:.
-
#keys ⇒ Object
Returns an array of keys for all this record’s attributes.
Constructor Details
#initialize(index_, geometry_, attributes_) ⇒ Record
:nodoc:
828 829 830 831 832 |
# File 'lib/rgeo/shapefile/reader.rb', line 828 def initialize(index_, geometry_, attributes_) # :nodoc: @index = index_ @geometry = geometry_ @attributes = attributes_ end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
The attributes as a hash.
841 842 843 |
# File 'lib/rgeo/shapefile/reader.rb', line 841 def attributes @attributes end |
#geometry ⇒ Object (readonly)
The geometry contained in this shapefile record
838 839 840 |
# File 'lib/rgeo/shapefile/reader.rb', line 838 def geometry @geometry end |
#index ⇒ Object (readonly)
The 0-based record number
835 836 837 |
# File 'lib/rgeo/shapefile/reader.rb', line 835 def index @index end |
Instance Method Details
#[](key_) ⇒ Object
Returns the value for the given attribute key.
849 850 851 |
# File 'lib/rgeo/shapefile/reader.rb', line 849 def [](key_) @attributes[key_.to_s] end |
#keys ⇒ Object
Returns an array of keys for all this record’s attributes.
844 845 846 |
# File 'lib/rgeo/shapefile/reader.rb', line 844 def keys @attributes.keys end |