class Resilience::FSDir::Record
Attributes
attribute[RW]
Public Class Methods
new(attribute)
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 12 def initialize(attribute) @attribute = attribute end
read()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 16 def self.read new(Attribute.read) end
Public Instance Methods
boundries()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 31 def boundries calc_boundries [@key_offset, @key_length, @value_offset, @value_length] end
calc_boundries()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 20 def calc_boundries return if @boundries_set @boundries_set = true header = attribute.unpack('S*') @key_offset = header[2] @key_length = header[3] @value_offset = header[5] @value_length = header[6] end
calc_flags()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 36 def calc_flags return if @flags_set @flags_set = true @flags = attribute.unpack('S*')[4] end
flags()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 43 def flags calc_flags @flags end
key()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 48 def key ko, kl, vo, vl = boundries attribute.unpack('C*')[ko...ko+kl].pack('C*') end
value()
click to toggle source
# File lib/resilience/fs_dir/record.rb, line 53 def value ko, kl, vo, vl = boundries attribute.unpack('C*')[vo..-1].pack('C*') end