class BootstrapBuilders::ArgumentsParser

Attributes

arguments[R]
arguments_hash[R]

Public Class Methods

new(args) click to toggle source
# 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

Private Instance Methods

parse_short_true_arguments() click to toggle source
# File lib/bootstrap_builders/arguments_parser.rb, line 23
def parse_short_true_arguments
  @arguments.delete_if do |argument|
    if @short_true_arguments.include?(argument)
      @arguments_hash[argument] = true
      true
    else
      false
    end
  end
end