Class: LS4::UpdateLogData

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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, *meta)
	@vtime = vtime
	@key = key
	@meta = meta
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



124
125
126
# File 'lib/ls4/service/ulog.rb', line 124

def key
  @key
end

#metaObject (readonly)

Returns the value of attribute meta.



125
126
127
# File 'lib/ls4/service/ulog.rb', line 125

def meta
  @meta
end

#vtimeObject (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)
	meta = []
	(n - 0x91).times {
		m, i = VariableByteCode.decode_index(raw, i)
		meta << m
	}
	key = raw[i..-1]
	new(vtime, key, *meta)
end

Instance Method Details

#dumpObject



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)
	meta.each {|m|
		VariableByteCode.encode(m, raw)
	}
	raw << key
	raw
end

#offsetObject



127
128
129
# File 'lib/ls4/service/ulog.rb', line 127

def offset
	@meta[0]
end

#sizeObject



131
132
133
# File 'lib/ls4/service/ulog.rb', line 131

def size
	@meta[1]
end