Class: Simatic::Types::IECDate
- Inherits:
-
Word
- Object
- SimaticType
- SimaticSimpleType
- Word
- Simatic::Types::IECDate
- Defined in:
- lib/simatic/types/iec_date.rb
Constant Summary collapse
- LENGTH =
2
Constants inherited from Word
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
8 9 10 11 |
# File 'lib/simatic/types/iec_date.rb', line 8 def self.parse_one raw_value days = super # days since 1990-01-01 Date.new(1990,1,1)+days end |
.serialize(value) ⇒ Object
13 14 15 16 17 |
# File 'lib/simatic/types/iec_date.rb', line 13 def self.serialize value raise "Value #{value} must be Date class instead of #{value.class}" unless value.kind_of? Date days = value - Date.new(1990,01,01) super days end |