Class: Skunk::Cli::Options
- Inherits:
-
Object
- Object
- Skunk::Cli::Options
- Defined in:
- lib/skunk/cli/options.rb,
lib/skunk/cli/options/argv.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Argv
Instance Attribute Summary collapse
-
#argv_options ⇒ Object
readonly
Returns the value of attribute argv_options.
-
#file_options ⇒ Object
readonly
Returns the value of attribute file_options.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Options
constructor
A new instance of Options.
- #parse ⇒ Object
-
#to_h ⇒ Object
:reek:NilCheck.
Constructor Details
#initialize(argv) ⇒ Options
Returns a new instance of Options.
12 13 14 15 |
# File 'lib/skunk/cli/options.rb', line 12 def initialize(argv) @argv_options = Argv.new(argv) @file_options = RubyCritic::Cli::Options::File.new end |
Instance Attribute Details
#argv_options ⇒ Object (readonly)
Returns the value of attribute argv_options.
10 11 12 |
# File 'lib/skunk/cli/options.rb', line 10 def @argv_options end |
#file_options ⇒ Object (readonly)
Returns the value of attribute file_options.
10 11 12 |
# File 'lib/skunk/cli/options.rb', line 10 def @file_options end |
Instance Method Details
#parse ⇒ Object
17 18 19 20 21 |
# File 'lib/skunk/cli/options.rb', line 17 def parse .parse .parse self end |
#to_h ⇒ Object
:reek:NilCheck
24 25 26 27 28 29 30 31 |
# File 'lib/skunk/cli/options.rb', line 24 def to_h file_hash = .to_h argv_hash = .to_h file_hash.merge(argv_hash) do |_, file_option, argv_option| Array(argv_option).empty? ? file_option : argv_option end end |