Class: Appx::File
- Inherits:
-
Object
- Object
- Appx::File
- Defined in:
- lib/appx/file.rb
Constant Summary collapse
- MANIFEST =
'AppxManifest.xml'
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(path) ⇒ File
Returns a new instance of File.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/appx/file.rb', line 10 def initialize(path) @path = path raise Appx::FileNotFoundError, path unless ::File.exist?(path) begin @zip_file = Zip::File.open(@path) rescue Zip::Error => e raise Appx::InvalidAppxError, e. end manifest_data = @zip_file.read(@zip_file.find_entry(MANIFEST)) @manifest = Appx::Manifest.new(manifest_data) end |
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
8 9 10 |
# File 'lib/appx/file.rb', line 8 def manifest @manifest end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/appx/file.rb', line 7 def path @path end |