Class: Example::Arguments

Inherits:
Object
  • Object
show all
Defined in:
examples/example.rb

Overview

Command-line option parser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Arguments

Returns a new instance of Arguments.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'examples/example.rb', line 28

def initialize(argv)
  @interface = 'localhost'
  @tls = :explicit
  @port = 0
  @auth_level = 'password'
  @user = ENV['LOGNAME']
  @password = ''
  @account = ''
  @session_timeout = default_session_timeout
  @log = nil
  op = option_parser
  op.parse!(argv)
rescue OptionParser::ParseError => e
  $stderr.puts e
  exit(1)
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



16
17
18
# File 'examples/example.rb', line 16

def 
  @account
end

#auth_levelObject (readonly)

Returns the value of attribute auth_level.



17
18
19
# File 'examples/example.rb', line 17

def auth_level
  @auth_level
end

#debugObject (readonly)

Returns the value of attribute debug.



18
19
20
# File 'examples/example.rb', line 18

def debug
  @debug
end

#eplfObject (readonly)

Returns the value of attribute eplf.



19
20
21
# File 'examples/example.rb', line 19

def eplf
  @eplf
end

#interfaceObject (readonly)

Returns the value of attribute interface.



20
21
22
# File 'examples/example.rb', line 20

def interface
  @interface
end

#passwordObject (readonly)

Returns the value of attribute password.



21
22
23
# File 'examples/example.rb', line 21

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



22
23
24
# File 'examples/example.rb', line 22

def port
  @port
end

#read_onlyObject (readonly)

Returns the value of attribute read_only.



23
24
25
# File 'examples/example.rb', line 23

def read_only
  @read_only
end

#session_timeoutObject (readonly)

Returns the value of attribute session_timeout.



24
25
26
# File 'examples/example.rb', line 24

def session_timeout
  @session_timeout
end

#tlsObject (readonly)

Returns the value of attribute tls.



25
26
27
# File 'examples/example.rb', line 25

def tls
  @tls
end

#userObject (readonly)

Returns the value of attribute user.



26
27
28
# File 'examples/example.rb', line 26

def user
  @user
end