Class: Simatic::Types::SimaticSimpleType
- Inherits:
-
SimaticType
- Object
- SimaticType
- Simatic::Types::SimaticSimpleType
- Defined in:
- lib/simatic/types/simatic_simple_type.rb
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_value) ⇒ Object
6 7 8 9 |
# File 'lib/simatic/types/simatic_simple_type.rb', line 6 def self.parse_one raw_value super raw_value.unpack(self::PATTERN).first end |
.serialize(value) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/simatic/types/simatic_simple_type.rb', line 11 def self.serialize value raise "Value must be numeric (value: #{value} type: #{value.class})" unless value.kind_of? Numeric # puts "class #{self::PATTERN}" # puts " PATTERN #{self::PATTERN} LENGTH #{self::LENGTH}" [value].pack(self::PATTERN) end |