Class: Lz4rip::Dictionary

Inherits:
Data
  • Object
show all
Defined in:
lib/lz4rip/dictionary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bytes:, id: Digest::SHA256.digest(bytes).byteslice(0, 4).unpack1("V")) ⇒ Dictionary

Returns a new instance of Dictionary.



7
8
9
# File 'lib/lz4rip/dictionary.rb', line 7

def initialize(bytes:, id: Digest::SHA256.digest(bytes).byteslice(0, 4).unpack1("V"))
  super(bytes: bytes.b.freeze, id: id)
end

Instance Attribute Details

#bytesObject (readonly)

Returns the value of attribute bytes

Returns:

  • (Object)

    the current value of bytes



6
7
8
# File 'lib/lz4rip/dictionary.rb', line 6

def bytes
  @bytes
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



6
7
8
# File 'lib/lz4rip/dictionary.rb', line 6

def id
  @id
end

Instance Method Details

#sizeObject



12
13
14
# File 'lib/lz4rip/dictionary.rb', line 12

def size
  bytes.bytesize
end