Class: Simatic::Types::Bool
- Inherits:
-
SimaticType
- Object
- SimaticType
- Simatic::Types::Bool
- Defined in:
- lib/simatic/types/bool.rb
Constant Summary collapse
- LENGTH =
1
Class Method Summary collapse
Methods inherited from SimaticType
#initialize, parse, #serialize
Constructor Details
This class inherits a constructor from Simatic::Types::SimaticType
Class Method Details
.parse_one(raw_data) ⇒ Object
8 9 10 11 |
# File 'lib/simatic/types/bool.rb', line 8 def self.parse_one raw_data super raw_data.unpack('b*').first.index('1') ? true : false end |
.serialize(value) ⇒ Object
13 14 15 |
# File 'lib/simatic/types/bool.rb', line 13 def self.serialize value [value ? 1 : 0].pack('c') end |