Class: Synoption::OptionArguments

Inherits:
Hash
  • Object
show all
Defined in:
lib/ragol/synoption/args.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, tag, description, default, origargs) ⇒ OptionArguments

Returns a new instance of OptionArguments.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ragol/synoption/args.rb', line 6

def initialize name, tag, description, default, origargs
  super()

  merge! origargs.dup
  
  takesvalue = if origargs.has_key?(:takesvalue)
                 origargs[:takesvalue]
               else
                 true
               end

  self[:takesvalue] = takesvalue
  self[:regexps] ||= origargs[:regexp]
  self[:negates] ||= origargs[:negate]
  self[:tags] = [ tag, '--' + name.to_s.gsub('_', '-') ]
  self[:description] = description
  self[:name] = name
  self[:default] = default
end