Class: Eco::CLI::Config::OptionsSet
- Inherits:
-
Object
- Object
- Eco::CLI::Config::OptionsSet
- Defined in:
- lib/eco/cli/config/options_set.rb
Instance Attribute Summary collapse
-
#core_config ⇒ Object
readonly
Returns the value of attribute core_config.
Instance Method Summary collapse
- #add(option) ⇒ Object
-
#initialize(core_config:) ⇒ OptionsSet
constructor
A new instance of OptionsSet.
- #process(io:) ⇒ Object
Constructor Details
#initialize(core_config:) ⇒ OptionsSet
7 8 9 10 |
# File 'lib/eco/cli/config/options_set.rb', line 7 def initialize(core_config:) @core_config = core_config = {} end |
Instance Attribute Details
#core_config ⇒ Object (readonly)
Returns the value of attribute core_config.
5 6 7 |
# File 'lib/eco/cli/config/options_set.rb', line 5 def core_config @core_config end |
Instance Method Details
#add(option) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/eco/cli/config/options_set.rb', line 12 def add(option) raise "Missing block to define the options builder" unless block_given? callback = Proc.new [option].flatten.compact.each do |opt| [opt] = callback end self end |
#process(io:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/eco/cli/config/options_set.rb', line 21 def process(io:) unless io && io.is_a?(Eco::API::UseCases::BaseIO) raise "You need to provide Eco::API::UseCases::BaseIO object. Given: #{io.class}" end .each do |arg, callback| callback.call(io., io.session) if SCR.get_arg(arg) end io. end |