Class: Imash::HashData

Inherits:
Object
  • Object
show all
Defined in:
lib/imash/hash_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ HashData

Returns a new instance of HashData.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/imash/hash_data.rb', line 6

def initialize(hash)

  bytes = hash.bytes.to_a

  @fg   = convert_fg(*bytes.shift(3))
  @bg   = convert_bg(*bytes.shift(3))

  @fg[0] = (((@bg[0].to_f / 255.0) + (@fg[0].to_f/255.0) / 3.33) * 255.0) % 255

  @seed = bytes.shift(8).each_with_index.inject(0) { |a, b| 
    a | ((b[0] & 0xFF) << b[1]*8) 
  }

end

Instance Attribute Details

#bgObject (readonly)

Returns the value of attribute bg.



4
5
6
# File 'lib/imash/hash_data.rb', line 4

def bg
  @bg
end

#fgObject (readonly)

Returns the value of attribute fg.



4
5
6
# File 'lib/imash/hash_data.rb', line 4

def fg
  @fg
end

#seedObject (readonly)

Returns the value of attribute seed.



4
5
6
# File 'lib/imash/hash_data.rb', line 4

def seed
  @seed
end