Class GeoRuby::Shp4r::Dbf::Reader
In: lib/geo_ruby/shp4r/dbf.rb
Parent: Object

Methods

close   field   new   open   record   records   reload!   row   rows   version_description  

Attributes

field_count  [R] 
fields  [R] 
header_length  [R] 
last_updated  [R] 
record_count  [R] 
record_length  [R] 
version  [R] 

Public Class methods

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 37
37:         def initialize(file)
38:           @data_file = File.open(file, 'rb')
39:           reload!
40:         end

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 42
42:         def self.open(file)
43:           reader = Reader.new(file)
44:           if block_given?
45:             yield reader
46:             reader.close
47:           else
48:             reader
49:           end
50:         end

Public Instance methods

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 52
52:         def close
53:           @data_file.close
54:         end

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 61
61:         def field(field_name)
62:           @fields.detect {|f| f.name == field_name.to_s}
63:         end

Jump to record

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 80
80:         def record(index)
81:           seek_to_record(index)
82:           active_record? ? build_record : nil
83:         end

An array of all the records contained in the database file

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 66
66:         def records
67:           seek_to_record(0)
68:           @records ||= Array.new(@record_count) do |i|
69:             if active_record?
70:               build_record
71:             else
72:               seek_to_record(i + 1)
73:               nil
74:             end
75:           end
76:         end

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 56
56:         def reload!
57:           get_header_info
58:           get_field_descriptors
59:         end
row(index)

Alias for record

rows()

Alias for records

[Source]

    # File lib/geo_ruby/shp4r/dbf.rb, line 87
87:         def version_description
88:           VERSION_DESCRIPTIONS[version]
89:         end

[Validate]