Class: Cabriolet::Models::OABHeader
- Inherits:
-
Object
- Object
- Cabriolet::Models::OABHeader
- Defined in:
- lib/cabriolet/models/oab_header.rb
Overview
OAB (Outlook Offline Address Book) file header
OAB files come in two variants:
-
Full files (version 3.1)
-
Incremental patches (version 3.2)
Instance Attribute Summary collapse
-
#block_max ⇒ Object
Returns the value of attribute block_max.
-
#is_patch ⇒ Object
Returns the value of attribute is_patch.
-
#source_crc ⇒ Object
Returns the value of attribute source_crc.
-
#source_size ⇒ Object
Returns the value of attribute source_size.
-
#target_crc ⇒ Object
Returns the value of attribute target_crc.
-
#target_size ⇒ Object
Returns the value of attribute target_size.
-
#version_hi ⇒ Object
Returns the value of attribute version_hi.
-
#version_lo ⇒ Object
Returns the value of attribute version_lo.
Instance Method Summary collapse
-
#full? ⇒ Boolean
Check if this is a full file.
-
#initialize(version_hi:, version_lo:, block_max:, target_size:, source_size: nil, source_crc: nil, target_crc: nil) ⇒ OABHeader
constructor
Create new OAB header.
-
#patch? ⇒ Boolean
Check if this is an incremental patch.
-
#valid? ⇒ Boolean
Check if this is a valid OAB header.
Constructor Details
#initialize(version_hi:, version_lo:, block_max:, target_size:, source_size: nil, source_crc: nil, target_crc: nil) ⇒ OABHeader
Create new OAB header
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cabriolet/models/oab_header.rb', line 23 def initialize(version_hi:, version_lo:, block_max:, target_size:, source_size: nil, source_crc: nil, target_crc: nil) @version_hi = version_hi @version_lo = version_lo @block_max = block_max @target_size = target_size @source_size = source_size @source_crc = source_crc @target_crc = target_crc @is_patch = (version_lo == 2) end |
Instance Attribute Details
#block_max ⇒ Object
Returns the value of attribute block_max.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def block_max @block_max end |
#is_patch ⇒ Object
Returns the value of attribute is_patch.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def is_patch @is_patch end |
#source_crc ⇒ Object
Returns the value of attribute source_crc.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def source_crc @source_crc end |
#source_size ⇒ Object
Returns the value of attribute source_size.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def source_size @source_size end |
#target_crc ⇒ Object
Returns the value of attribute target_crc.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def target_crc @target_crc end |
#target_size ⇒ Object
Returns the value of attribute target_size.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def target_size @target_size end |
#version_hi ⇒ Object
Returns the value of attribute version_hi.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def version_hi @version_hi end |
#version_lo ⇒ Object
Returns the value of attribute version_lo.
11 12 13 |
# File 'lib/cabriolet/models/oab_header.rb', line 11 def version_lo @version_lo end |
Instance Method Details
#full? ⇒ Boolean
Check if this is a full file
52 53 54 |
# File 'lib/cabriolet/models/oab_header.rb', line 52 def full? !is_patch end |
#patch? ⇒ Boolean
Check if this is an incremental patch
45 46 47 |
# File 'lib/cabriolet/models/oab_header.rb', line 45 def patch? is_patch end |
#valid? ⇒ Boolean
Check if this is a valid OAB header
38 39 40 |
# File 'lib/cabriolet/models/oab_header.rb', line 38 def valid? version_hi == 3 && [1, 2].include?(version_lo) end |