Class: DBF::ColumnType::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column) ⇒ Base

Returns a new instance of Base.

Parameters:

  • decimal (Integer)
  • encoding (String, Encoding)


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

#decimalObject (readonly)

Returns the value of attribute decimal.



6
7
8
# File 'lib/dbf/column_type.rb', line 6

def decimal
  @decimal
end

#encodingObject (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_valueObject



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

#skip_blank?Boolean

Returns:



19
20
21
# File 'lib/dbf/column_type.rb', line 19

def skip_blank?
  false
end