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.



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

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.



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

def arguments_consumer
  @arguments_consumer
end

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end