Class: LS4::UpdateLogData
- Inherits:
-
Object
- Object
- LS4::UpdateLogData
- Defined in:
- lib/ls4/service/ulog.rb
Overview
-
——--...---
|1|vbcode| raw | -
——--...---
0x91
vtime
key
-
——------
——--...---
|1|vbcode|vbcode|vbcode| raw | -
——------
——--...---
0x93
vtime
offset
size
key
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#vtime ⇒ Object
readonly
Returns the value of attribute vtime.
Class Method Summary collapse
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(vtime, key, *meta) ⇒ UpdateLogData
constructor
A new instance of UpdateLogData.
- #offset ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(vtime, key, *meta) ⇒ UpdateLogData
Returns a new instance of UpdateLogData.
117 118 119 120 121 |
# File 'lib/ls4/service/ulog.rb', line 117 def initialize(vtime, key, *) @vtime = vtime @key = key @meta = end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
124 125 126 |
# File 'lib/ls4/service/ulog.rb', line 124 def key @key end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
125 126 127 |
# File 'lib/ls4/service/ulog.rb', line 125 def @meta end |
#vtime ⇒ Object (readonly)
Returns the value of attribute vtime.
123 124 125 |
# File 'lib/ls4/service/ulog.rb', line 123 def vtime @vtime end |
Class Method Details
.load(raw) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/ls4/service/ulog.rb', line 145 def self.load(raw) n = raw.unpack('C')[0] vtime, i = VariableByteCode.decode_index(raw, 1) = [] (n - 0x91).times { m, i = VariableByteCode.decode_index(raw, i) << m } key = raw[i..-1] new(vtime, key, *) end |
Instance Method Details
#dump ⇒ Object
135 136 137 138 139 140 141 142 143 |
# File 'lib/ls4/service/ulog.rb', line 135 def dump raw = [0x91 + @meta.size].pack('C') VariableByteCode.encode(@vtime, raw) .each {|m| VariableByteCode.encode(m, raw) } raw << key raw end |
#offset ⇒ Object
127 128 129 |
# File 'lib/ls4/service/ulog.rb', line 127 def offset @meta[0] end |
#size ⇒ Object
131 132 133 |
# File 'lib/ls4/service/ulog.rb', line 131 def size @meta[1] end |