Class: RBase::Columns::MemoColumn
Instance Attribute Summary
Attributes inherited from Column
#decimal, #name, #offset, #size
Instance Method Summary
collapse
Methods inherited from Column
#attach_to, column_for, column_type, #type, type
Constructor Details
#initialize(name, options = {}) ⇒ MemoColumn
207
208
209
|
# File 'lib/rbase/columns.rb', line 207
def initialize(name, options = {})
super name, options.merge(:size => 10)
end
|
Instance Method Details
#inspect ⇒ Object
220
221
222
|
# File 'lib/rbase/columns.rb', line 220
def inspect
"#{name}(memo)"
end
|
#pack(value) ⇒ Object
211
212
213
214
|
# File 'lib/rbase/columns.rb', line 211
def pack(value)
packed_value = table.memo.write(value)
[format("%-10d", packed_value)].pack('A10')
end
|
#unpack(data) ⇒ Object
216
217
218
|
# File 'lib/rbase/columns.rb', line 216
def unpack(data)
table.memo.read(data.to_i)
end
|