Class: ReverseTunnel::CLI::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/reverse-tunnel/cli.rb

Direct Known Subclasses

Configurator, Global

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments = []) ⇒ Base

Returns a new instance of Base.



18
19
20
# File 'lib/reverse-tunnel/cli.rb', line 18

def initialize(arguments = [])
  @arguments = arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



16
17
18
# File 'lib/reverse-tunnel/cli.rb', line 16

def arguments
  @arguments
end

Instance Method Details

#configure(object = self) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/reverse-tunnel/cli.rb', line 28

def configure(object = self)
  options.each do |k,v| 
    unless [:help, :version].include? k or k.to_s =~ /_given$/
      object.send "#{k.to_s.gsub('-','_')}=", v 
    end
  end

  object
end

#optionsObject



22
23
24
25
26
# File 'lib/reverse-tunnel/cli.rb', line 22

def options
  @options ||= Trollop::with_standard_exception_handling(parser) do
    parser.parse arguments
  end
end