Class: LibSL::LLNumber
- Inherits:
-
Object
show all
- Defined in:
- lib/types.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value) ⇒ LLNumber
Returns a new instance of LLNumber.
147
148
149
|
# File 'lib/types.rb', line 147
def initialize(value)
@value = value
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
146
147
148
|
# File 'lib/types.rb', line 146
def value
@value
end
|
Class Method Details
.decode(data, pattern, klass) ⇒ Object
127
128
129
130
|
# File 'lib/types.rb', line 127
def self.decode(data, pattern, klass)
data = data.unpack(pattern)
return klass.new(data[0]), data[1]
end
|
.endianness ⇒ Object
132
133
134
135
136
137
138
139
140
|
# File 'lib/types.rb', line 132
def self.endianness()
little = "78563412"
big = "12345678"
case "%8x" % ([0x12345678].pack('l').unpack('N')[0])
when little then :little
when big then :big
else :other
end
end
|
Instance Method Details
#encode(pattern) ⇒ Object
142
143
144
|
# File 'lib/types.rb', line 142
def encode(pattern)
[@value].pack(pattern)
end
|