Class: SML::ProcParameterValue
- Inherits:
-
Object
- Object
- SML::ProcParameterValue
- Defined in:
- lib/ruby-sml/sml-procparametervalue.rb
Class Method Summary collapse
Class Method Details
.construct(array_rep) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby-sml/sml-procparametervalue.rb', line 10 def self.construct(array_rep) return nil if array_rep.nil? choice = array_rep.shift array_rep.shift unless choice.nil? body_rep = array_rep.shift return case choice when 0x01 body_rep when 0x02 SML::PeriodEntry.construct(body_rep) when 0x03 SML::TupelEntry.construct(body_rep) when 0x04 SML::Time.construct(body_rep) end end |
.to_a(object) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby-sml/sml-procparametervalue.rb', line 27 def self.to_a(object) choice = case object when SML::PeriodEntry 0x02 when SML::TupelEntry 0x03 when SML::Time 0x04 else 0x01 end result = [] << choice result << :uint8 unless choice.nil? return result << object end |