Class: SML::ProfileObjectHeaderEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-sml/sml-profileobjectheaderentry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, unit, scaler) ⇒ ProfileObjectHeaderEntry

Returns a new instance of ProfileObjectHeaderEntry.


8
9
10
11
12
# File 'lib/ruby-sml/sml-profileobjectheaderentry.rb', line 8

def initialize(name, unit, scaler)
  @name = name
  @unit = unit
  @scaler = scaler
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.


6
7
8
# File 'lib/ruby-sml/sml-profileobjectheaderentry.rb', line 6

def name
  @name
end

#scalerObject

Returns the value of attribute scaler.


6
7
8
# File 'lib/ruby-sml/sml-profileobjectheaderentry.rb', line 6

def scaler
  @scaler
end

#unitObject

Returns the value of attribute unit.


6
7
8
# File 'lib/ruby-sml/sml-profileobjectheaderentry.rb', line 6

def unit
  @unit
end

Class Method Details

.construct(array_rep) ⇒ Object


14
15
16
17
18
19
20
21
22
# File 'lib/ruby-sml/sml-profileobjectheaderentry.rb', line 14

def self.construct(array_rep)
  return nil if array_rep.nil?
  name = array_rep.shift
  unit = array_rep.shift
  scaler = array_rep.shift
  array_rep.shift unless scaler.nil?

  return SML::ProfileObjectHeaderEntry.new(name, unit, scaler)
end

Instance Method Details

#to_aObject


23
24
25
26
27
# File 'lib/ruby-sml/sml-profileobjectheaderentry.rb', line 23

def to_a
  result = [] << name << unit << scaler
  result << :int8 unless scaler.nil?
  return result
end