Class: FixedLayoutMapper::Mapper::SimpleMapper
Instance Attribute Summary
Attributes inherited from ColumnMapper
#converter, #layout_mapper
Instance Method Summary
collapse
#convert
Constructor Details
#initialize(layout_mapper, len, converter = nil) ⇒ SimpleMapper
Returns a new instance of SimpleMapper.
25
26
27
28
|
# File 'lib/fixed-layout-mapper.rb', line 25
def initialize(layout_mapper, len, converter = nil)
super layout_mapper, converter
@len = len
end
|
Instance Method Details
#length ⇒ Object
30
31
32
|
# File 'lib/fixed-layout-mapper.rb', line 30
def length
@len
end
|
#map(bytes) ⇒ Object
34
35
36
37
38
|
# File 'lib/fixed-layout-mapper.rb', line 34
def map(bytes)
value = bytes.take(@len).pack("C*").force_encoding(layout_mapper.encoding)
[convert(value), bytes.drop(@len)]
end
|