Class: Mix1::Package::File
- Inherits:
-
Object
- Object
- Mix1::Package::File
- Defined in:
- lib/mix1.rb
Instance Attribute Summary collapse
-
#content_length ⇒ Object
Returns the value of attribute content_length.
-
#content_offset ⇒ Object
Returns the value of attribute content_offset.
-
#data ⇒ Object
Returns the value of attribute data.
-
#mix_crc ⇒ Object
Returns the value of attribute mix_crc.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #data_crc ⇒ Object
- #file_crc ⇒ Object
-
#initialize(name:, mix_crc: nil, content_offset: nil, content_length: nil, data: nil) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(name:, mix_crc: nil, content_offset: nil, content_length: nil, data: nil) ⇒ File
Returns a new instance of File.
338 339 340 341 342 343 344 |
# File 'lib/mix1.rb', line 338 def initialize(name:, mix_crc: nil, content_offset: nil, content_length: nil, data: nil) @name = name @mix_crc = mix_crc @content_offset = content_offset @content_length = content_length @data = data end |
Instance Attribute Details
#content_length ⇒ Object
Returns the value of attribute content_length.
336 337 338 |
# File 'lib/mix1.rb', line 336 def content_length @content_length end |
#content_offset ⇒ Object
Returns the value of attribute content_offset.
336 337 338 |
# File 'lib/mix1.rb', line 336 def content_offset @content_offset end |
#data ⇒ Object
Returns the value of attribute data.
336 337 338 |
# File 'lib/mix1.rb', line 336 def data @data end |
#mix_crc ⇒ Object
Returns the value of attribute mix_crc.
336 337 338 |
# File 'lib/mix1.rb', line 336 def mix_crc @mix_crc end |
#name ⇒ Object
Returns the value of attribute name.
336 337 338 |
# File 'lib/mix1.rb', line 336 def name @name end |
Instance Method Details
#data_crc ⇒ Object
352 353 354 |
# File 'lib/mix1.rb', line 352 def data_crc Digest::CRC32.hexdigest(@data) end |
#file_crc ⇒ Object
346 347 348 349 350 |
# File 'lib/mix1.rb', line 346 def file_crc return "e6fe46b8" if @name.downcase == ".w3dhub.patch" Digest::CRC32.hexdigest(@name.upcase) end |