Class: EacRubyUtils::ArgumentsConsumer

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/arguments_consumer.rb

Defined Under Namespace

Classes: InvalidArgumentError, Parser

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(positional, default_options) ⇒ ArgumentsConsumer

Returns a new instance of ArgumentsConsumer.


16
17
18
19
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 16

def initialize(positional, default_options)
  @positional = positional.dup.freeze
  @default_options = default_options.dup.freeze
end

Instance Attribute Details

#default_optionsObject (readonly)

Returns the value of attribute default_options


14
15
16
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 14

def default_options
  @default_options
end

#positionalObject (readonly)

Returns the value of attribute positional


14
15
16
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 14

def positional
  @positional
end

Class Method Details

.parse(args, positional = [], options = {}) ⇒ Object


9
10
11
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 9

def parse(args, positional = [], options = {})
  new(args, positional, options).data
end

Instance Method Details

#parse(args) ⇒ Object


21
22
23
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 21

def parse(args)
  Parser.new(self, args).data
end