Class: MooTool::Models::DeviceTree::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/mootool/models/device_tree.rb

Overview

Represents a single property and it's value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Property

Returns a new instance of Property.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mootool/models/device_tree.rb', line 49

def initialize(data)
  args = data.read(36).unpack(PROP_FORMAT)

  @name = args[0]
  @size = args[1]

  if @size & 0x80000000 != 0
    @template = true
    @size &= 0x7fffffff
  end

  @value = T.must(data.read(@size.align(4)))[0..(@size - 1)]

  normalize
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



47
48
49
# File 'lib/mootool/models/device_tree.rb', line 47

def name
  @name
end

#valueObject

Returns the value of attribute value.



47
48
49
# File 'lib/mootool/models/device_tree.rb', line 47

def value
  @value
end