Class: XABA::Manifest::AssemblyInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/xaba/manifest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash32, hash64, blob_id, blob_idx, name) ⇒ AssemblyInfo

Returns a new instance of AssemblyInfo.



10
11
12
13
14
15
16
17
# File 'lib/xaba/manifest.rb', line 10

def initialize(hash32, hash64, blob_id, blob_idx, name)
  @hash32 = hash32.to_i(16)
  @hash64 = hash64.to_i(16)
  @blob_id = blob_id.to_i
  @blob_idx = blob_idx.to_i
  @name = name
  raise unless valid?
end

Instance Attribute Details

#blob_idObject

Returns the value of attribute blob_id.



8
9
10
# File 'lib/xaba/manifest.rb', line 8

def blob_id
  @blob_id
end

#blob_idxObject

Returns the value of attribute blob_idx.



8
9
10
# File 'lib/xaba/manifest.rb', line 8

def blob_idx
  @blob_idx
end

#hash32Object

Returns the value of attribute hash32.



8
9
10
# File 'lib/xaba/manifest.rb', line 8

def hash32
  @hash32
end

#hash64Object

Returns the value of attribute hash64.



8
9
10
# File 'lib/xaba/manifest.rb', line 8

def hash64
  @hash64
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/xaba/manifest.rb', line 8

def name
  @name
end

Instance Method Details

#inspectObject



19
20
21
22
# File 'lib/xaba/manifest.rb', line 19

def inspect
  format("<AssemblyInfo hash32=%08x hash64=%016x blob_id=%d blob_idx=%3d name=%s>", hash32, hash64, blob_id,
         blob_idx, name.inspect)
end

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/xaba/manifest.rb', line 24

def valid?
  XXhash.xxh32(name) == hash32 && XXhash.xxh64(name) == hash64
end