Class: DBF::ColumnType::Base
- Inherits:
-
Object
- Object
- DBF::ColumnType::Base
- Defined in:
- lib/dbf/column_type.rb
Direct Known Subclasses
AutoIncrement, Boolean, Currency, Date, DateTime, Double, Float, General, Memo, Nil, Number, SignedLong, String
Instance Attribute Summary collapse
-
#decimal ⇒ Object
readonly
Returns the value of attribute decimal.
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
Instance Method Summary collapse
- #blank_value ⇒ Object
- #decode(raw, &_memo_handler) ⇒ Object
-
#initialize(column) ⇒ Base
constructor
A new instance of Base.
- #skip_blank? ⇒ Boolean
Constructor Details
#initialize(column) ⇒ Base
Returns a new instance of Base.
10 11 12 13 |
# File 'lib/dbf/column_type.rb', line 10 def initialize(column) @decimal = column.decimal @encoding = column.encoding end |
Instance Attribute Details
#decimal ⇒ Object (readonly)
Returns the value of attribute decimal.
6 7 8 |
# File 'lib/dbf/column_type.rb', line 6 def decimal @decimal end |
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
6 7 8 |
# File 'lib/dbf/column_type.rb', line 6 def encoding @encoding end |
Instance Method Details
#blank_value ⇒ Object
15 16 17 |
# File 'lib/dbf/column_type.rb', line 15 def blank_value nil end |
#decode(raw, &_memo_handler) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/dbf/column_type.rb', line 23 def decode(raw, &_memo_handler) if skip_blank? && raw.count(' ') == raw.length blank_value else type_cast(raw) end end |