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.



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

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.



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

def default_options
  @default_options
end

#positionalObject (readonly)

Returns the value of attribute positional.



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

def positional
  @positional
end

Class Method Details

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



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

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

Instance Method Details

#parse(args) ⇒ Object



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

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