Class: GeoRuby::Shp4r::Dbf::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_ruby/shp4r/dbf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, length, decimal = 0) ⇒ Field

Returns a new instance of Field.

Raises:



166
167
168
169
170
171
172
# File 'lib/geo_ruby/shp4r/dbf.rb', line 166

def initialize(name, type, length, decimal = 0)
  raise FieldError, "field length must be greater than 0" unless length > 0
  if type == 'N' and decimal != 0
    type = 'F'
  end
  @name, @type, @length, @decimal = name.strip, type,length, decimal
end

Instance Attribute Details

#decimalObject (readonly)

Returns the value of attribute decimal.



164
165
166
# File 'lib/geo_ruby/shp4r/dbf.rb', line 164

def decimal
  @decimal
end

#lengthObject (readonly)

Returns the value of attribute length.



164
165
166
# File 'lib/geo_ruby/shp4r/dbf.rb', line 164

def length
  @length
end

#nameObject (readonly)

Returns the value of attribute name.



164
165
166
# File 'lib/geo_ruby/shp4r/dbf.rb', line 164

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



164
165
166
# File 'lib/geo_ruby/shp4r/dbf.rb', line 164

def type
  @type
end