Class: Omnizip::Commands::MetadataCommand
- Inherits:
-
Object
- Object
- Omnizip::Commands::MetadataCommand
- Defined in:
- lib/omnizip/commands/metadata_command.rb
Overview
Metadata command implementation
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MetadataCommand
constructor
A new instance of MetadataCommand.
-
#run(archive_path, pattern = nil) ⇒ Object
Run the metadata command.
Constructor Details
#initialize(options = {}) ⇒ MetadataCommand
Returns a new instance of MetadataCommand.
9 10 11 |
# File 'lib/omnizip/commands/metadata_command.rb', line 9 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/omnizip/commands/metadata_command.rb', line 7 def @options end |
Instance Method Details
#run(archive_path, pattern = nil) ⇒ Object
Run the metadata command
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/omnizip/commands/metadata_command.rb', line 16 def run(archive_path, pattern = nil) unless File.exist?(archive_path) raise Errno::ENOENT, "Archive not found: #{archive_path}" end if seven_zip?(archive_path) (archive_path, pattern) return end unless zip?(archive_path) raise ArgumentError, "Metadata is supported for .zip and .7z archives: " \ "#{archive_path}" end Omnizip::Zip::File.open(archive_path) do |archive| if [:show] || editing_nothing? (archive, pattern) else (archive, pattern) puts "Metadata updated successfully" end end end |