class Bcome::Registry::Arguments::CommandLine

Public Class Methods

new(arguments, defaults) click to toggle source
Calls superclass method Bcome::Registry::Arguments::Base::new
# File lib/objects/registry/arguments/command_line.rb, line 5
def initialize(arguments, defaults)
  @arguments = arguments || []
  @processed_arguments = {}
  super
end

Public Instance Methods

arguments_to_merge() click to toggle source
# File lib/objects/registry/arguments/command_line.rb, line 16
def arguments_to_merge
  @processed_arguments
end
do_process() click to toggle source
# File lib/objects/registry/arguments/command_line.rb, line 11
def do_process
  parse_arguments
  super
end

Private Instance Methods

parse_arguments() click to toggle source
# File lib/objects/registry/arguments/command_line.rb, line 22
def parse_arguments
  @arguments.each do |argument|
    argument =~ /^(.+)=(.+)$/
    raise Bcome::Exception::MalformedCommandLineArguments, argument unless Regexp.last_match(1) || Regexp.last_match(2)

    key = Regexp.last_match(1).to_sym; value = Regexp.last_match(2)
    raise Bcome::Exception::DuplicateCommandLineArgumentKey, "'#{key}'" if @processed_arguments.key?(key)

    @processed_arguments[key] = value
  end
end
validate() click to toggle source
# File lib/objects/registry/arguments/command_line.rb, line 34
def validate
  raise Bcome::Exception::InvalidRegistryArgumentType, 'invalid argument format' unless @arguments.is_a?(Array)

  super
end