Class: LS4::FileUpdateLog::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/ls4/service/ulog_file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reltime, data) ⇒ Record

Returns a new instance of Record.



49
50
51
52
# File 'lib/ls4/service/ulog_file.rb', line 49

def initialize(reltime, data)
	@reltime = reltime
	@data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



55
56
57
# File 'lib/ls4/service/ulog_file.rb', line 55

def data
  @data
end

#reltimeObject (readonly)

Returns the value of attribute reltime.



54
55
56
# File 'lib/ls4/service/ulog_file.rb', line 54

def reltime
  @reltime
end

Class Method Details

.read(stream) ⇒ Object



71
72
73
# File 'lib/ls4/service/ulog_file.rb', line 71

def self.read(stream)
	new *read_impl(stream, true)
end

.read_nodata(stream) ⇒ Object



75
76
77
# File 'lib/ls4/service/ulog_file.rb', line 75

def self.read_nodata(stream)
	return read_impl(stream, false)
end

Instance Method Details

#write(stream) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ls4/service/ulog_file.rb', line 57

def write(stream)
	meta = [@reltime]

	bmeta = meta.to_msgpack
	rsize = bmeta.size + @data.size
	brsize = VariableByteCode.encode(rsize)

	stream.write(brsize)
	stream.write(bmeta)
	stream.write(@data)

	brsize.size + bmeta.size + @data.size
end