Class: BootstrapBuilders::ArgumentsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap_builders/arguments_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ ArgumentsParser

Returns a new instance of ArgumentsParser.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bootstrap_builders/arguments_parser.rb', line 4

def initialize(args)
  @arguments = args.fetch(:arguments)

  if args[:argument_hash_default]
    @arguments_hash = args.fetch(:argument_hash_default)
  else
    @arguments_hash = {}
  end

  @arguments_hash = @arguments_hash.merge(@arguments.pop) if @arguments.last.is_a?(Hash)

  @arguments << @arguments_hash

  @short_true_arguments = args[:short_true_arguments]
  parse_short_true_arguments if @short_true_arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



2
3
4
# File 'lib/bootstrap_builders/arguments_parser.rb', line 2

def arguments
  @arguments
end

#arguments_hashObject (readonly)

Returns the value of attribute arguments_hash.



2
3
4
# File 'lib/bootstrap_builders/arguments_parser.rb', line 2

def arguments_hash
  @arguments_hash
end