Class: EacRubyUtils::ArgumentsConsumer::Parser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments_consumer, args) ⇒ Parser

Returns a new instance of Parser.


28
29
30
31
32
33
34
35
36
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 28

def initialize(arguments_consumer, args)
  @arguments_consumer = arguments_consumer
  @data = ::ActiveSupport::HashWithIndifferentAccess.new
  @options_found = false
  arguments_consumer.positional.each { |key| data[key] = nil }
  data.merge!(arguments_consumer.default_options)
  args.each_with_index { |value, index| add_arg(value, index) }
  data.freeze
end

Instance Attribute Details

#arguments_consumerObject (readonly)

Returns the value of attribute arguments_consumer


26
27
28
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 26

def arguments_consumer
  @arguments_consumer
end

#dataObject (readonly)

Returns the value of attribute data


26
27
28
# File 'lib/eac_ruby_utils/arguments_consumer.rb', line 26

def data
  @data
end