Class: MooTool::DeviceTree::Property

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
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.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mootool/models/device_tree.rb', line 59

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

  @name = T.let(T.cast(args[0], String), String)
  @size = T.let(T.cast(args[1], Integer), Integer)

  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.



56
57
58
# File 'lib/mootool/models/device_tree.rb', line 56

def name
  @name
end

#valueObject

Returns the value of attribute value.



56
57
58
# File 'lib/mootool/models/device_tree.rb', line 56

def value
  @value
end