Class: ArgsParser::Switches

Inherits:
Object
  • Object
show all
Defined in:
lib/argsparser/switches.rb

Instance Method Summary collapse

Constructor Details

#initialize(switches) ⇒ Switches

Returns a new instance of Switches.



3
4
5
# File 'lib/argsparser/switches.rb', line 3

def initialize(switches)
  @s = switches
end

Instance Method Details

#[](a) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/argsparser/switches.rb', line 7

def [](a)
  if @s[a.to_sym]
    if @s[a.to_sym][:arg] == :none
      return true
    else
      return @s[a.to_sym][:arg]
    end
  else
    return nil
  end
end