Class: Bane::CommandLineConfiguration
- Inherits:
-
Object
- Object
- Bane::CommandLineConfiguration
- Defined in:
- lib/bane/command_line_configuration.rb
Instance Method Summary collapse
-
#initialize(makeables) ⇒ CommandLineConfiguration
constructor
A new instance of CommandLineConfiguration.
- #process(args, &error_policy) ⇒ Object
Constructor Details
#initialize(makeables) ⇒ CommandLineConfiguration
Returns a new instance of CommandLineConfiguration.
12 13 14 15 |
# File 'lib/bane/command_line_configuration.rb', line 12 def initialize(makeables) @behavior_maker = BehaviorMaker.new(makeables) @arguments_parser = ArgumentsParser.new(makeables.keys) end |
Instance Method Details
#process(args, &error_policy) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/bane/command_line_configuration.rb', line 17 def process(args, &error_policy) arguments = @arguments_parser.parse(args) create(arguments.behaviors, arguments.port, arguments.host) rescue ConfigurationError => ce error_policy.call([ce., @arguments_parser.usage].join("\n")) end |