Class: Cabriolet::Models::Cabinet
- Inherits:
-
Object
- Object
- Cabriolet::Models::Cabinet
- Defined in:
- lib/cabriolet/models/cabinet.rb
Overview
Cabinet represents a CAB file or cabinet set
Instance Attribute Summary collapse
-
#base_offset ⇒ Object
Returns the value of attribute base_offset.
-
#block_resv ⇒ Object
readonly
Returns the value of attribute block_resv.
-
#blocks_offset ⇒ Object
readonly
Returns the value of attribute blocks_offset.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#files ⇒ Object
Returns the value of attribute files.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#folders ⇒ Object
Returns the value of attribute folders.
-
#header_resv ⇒ Object
Returns the value of attribute header_resv.
-
#length ⇒ Object
Returns the value of attribute length.
-
#next ⇒ Object
Returns the value of attribute next.
-
#next_cabinet ⇒ Object
Returns the value of attribute next_cabinet.
-
#nextinfo ⇒ Object
Returns the value of attribute nextinfo.
-
#nextname ⇒ Object
Returns the value of attribute nextname.
-
#prev_cabinet ⇒ Object
Returns the value of attribute prev_cabinet.
-
#previnfo ⇒ Object
Returns the value of attribute previnfo.
-
#prevname ⇒ Object
Returns the value of attribute prevname.
-
#set_id ⇒ Object
Returns the value of attribute set_id.
-
#set_index ⇒ Object
Returns the value of attribute set_index.
Instance Method Summary collapse
-
#file_count ⇒ Integer
Get total number of files.
-
#folder_count ⇒ Integer
Get total number of folders.
-
#has_next? ⇒ Boolean
Check if this cabinet has a successor.
-
#has_prev? ⇒ Boolean
Check if this cabinet has a predecessor.
-
#has_reserve? ⇒ Boolean
Check if this cabinet has reserved space.
-
#initialize(filename = nil) ⇒ Cabinet
constructor
Initialize a new cabinet.
-
#set_blocks_info(offset, resv) ⇒ void
Set the blocks offset and reserved space.
Constructor Details
#initialize(filename = nil) ⇒ Cabinet
Initialize a new cabinet
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cabriolet/models/cabinet.rb', line 14 def initialize(filename = nil) @filename = filename @base_offset = 0 @length = 0 @set_id = 0 @set_index = 0 @flags = 0 @header_resv = 0 @prevname = nil @nextname = nil @previnfo = nil @nextinfo = nil @folders = [] @files = [] @next_cabinet = nil @prev_cabinet = nil @next = nil @blocks_offset = 0 @block_resv = 0 end |
Instance Attribute Details
#base_offset ⇒ Object
Returns the value of attribute base_offset.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def base_offset @base_offset end |
#block_resv ⇒ Object (readonly)
Returns the value of attribute block_resv.
9 10 11 |
# File 'lib/cabriolet/models/cabinet.rb', line 9 def block_resv @block_resv end |
#blocks_offset ⇒ Object (readonly)
Returns the value of attribute blocks_offset.
9 10 11 |
# File 'lib/cabriolet/models/cabinet.rb', line 9 def blocks_offset @blocks_offset end |
#filename ⇒ Object
Returns the value of attribute filename.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def filename @filename end |
#files ⇒ Object
Returns the value of attribute files.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def files @files end |
#flags ⇒ Object
Returns the value of attribute flags.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def flags @flags end |
#folders ⇒ Object
Returns the value of attribute folders.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def folders @folders end |
#header_resv ⇒ Object
Returns the value of attribute header_resv.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def header_resv @header_resv end |
#length ⇒ Object
Returns the value of attribute length.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def length @length end |
#next ⇒ Object
Returns the value of attribute next.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def next @next end |
#next_cabinet ⇒ Object
Returns the value of attribute next_cabinet.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def next_cabinet @next_cabinet end |
#nextinfo ⇒ Object
Returns the value of attribute nextinfo.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def nextinfo @nextinfo end |
#nextname ⇒ Object
Returns the value of attribute nextname.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def nextname @nextname end |
#prev_cabinet ⇒ Object
Returns the value of attribute prev_cabinet.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def prev_cabinet @prev_cabinet end |
#previnfo ⇒ Object
Returns the value of attribute previnfo.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def previnfo @previnfo end |
#prevname ⇒ Object
Returns the value of attribute prevname.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def prevname @prevname end |
#set_id ⇒ Object
Returns the value of attribute set_id.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def set_id @set_id end |
#set_index ⇒ Object
Returns the value of attribute set_index.
7 8 9 |
# File 'lib/cabriolet/models/cabinet.rb', line 7 def set_index @set_index end |
Instance Method Details
#file_count ⇒ Integer
Get total number of files
69 70 71 |
# File 'lib/cabriolet/models/cabinet.rb', line 69 def file_count @files.size end |
#folder_count ⇒ Integer
Get total number of folders
76 77 78 |
# File 'lib/cabriolet/models/cabinet.rb', line 76 def folder_count @folders.size end |
#has_next? ⇒ Boolean
Check if this cabinet has a successor
45 46 47 |
# File 'lib/cabriolet/models/cabinet.rb', line 45 def has_next? @flags.anybits?(Constants::FLAG_NEXT_CABINET) end |
#has_prev? ⇒ Boolean
Check if this cabinet has a predecessor
38 39 40 |
# File 'lib/cabriolet/models/cabinet.rb', line 38 def has_prev? @flags.anybits?(Constants::FLAG_PREV_CABINET) end |
#has_reserve? ⇒ Boolean
Check if this cabinet has reserved space
52 53 54 |
# File 'lib/cabriolet/models/cabinet.rb', line 52 def has_reserve? @flags.anybits?(Constants::FLAG_RESERVE_PRESENT) end |
#set_blocks_info(offset, resv) ⇒ void
This method returns an undefined value.
Set the blocks offset and reserved space
61 62 63 64 |
# File 'lib/cabriolet/models/cabinet.rb', line 61 def set_blocks_info(offset, resv) @blocks_offset = offset @block_resv = resv end |