Class: RBase::Columns::LogicalColumn
- Defined in:
- lib/rbase/columns.rb
Instance Attribute Summary
Attributes inherited from Column
#decimal, #name, #offset, #size
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ LogicalColumn
constructor
A new instance of LogicalColumn.
- #inspect ⇒ Object
- #pack(value) ⇒ Object
- #unpack(data) ⇒ Object
Methods inherited from Column
#attach_to, column_for, column_type, #type, type
Constructor Details
#initialize(name, options = {}) ⇒ LogicalColumn
Returns a new instance of LogicalColumn.
153 154 155 |
# File 'lib/rbase/columns.rb', line 153 def initialize(name, = {}) super name, .merge(:size => 1) end |
Instance Method Details
#inspect ⇒ Object
176 177 178 |
# File 'lib/rbase/columns.rb', line 176 def inspect "#{name}(boolean)" end |
#pack(value) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/rbase/columns.rb', line 157 def pack(value) case value when true then 'T' when false then 'F' else '?' end end |
#unpack(data) ⇒ Object
165 166 167 168 169 170 171 172 173 174 |
# File 'lib/rbase/columns.rb', line 165 def unpack(data) case data.upcase when 'Y', 'T' true when 'N', 'F' false else nil end end |