Class: Example::Arguments
- Inherits:
-
Object
- Object
- Example::Arguments
- Defined in:
- examples/example.rb
Overview
Command-line option parser
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#auth_level ⇒ Object
readonly
Returns the value of attribute auth_level.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#eplf ⇒ Object
readonly
Returns the value of attribute eplf.
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#read_only ⇒ Object
readonly
Returns the value of attribute read_only.
-
#session_timeout ⇒ Object
readonly
Returns the value of attribute session_timeout.
-
#tls ⇒ Object
readonly
Returns the value of attribute tls.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Arguments
constructor
A new instance of Arguments.
Constructor Details
#initialize(argv) ⇒ Arguments
Returns a new instance of Arguments.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'examples/example.rb', line 29 def initialize(argv) @interface = '127.0.0.1' @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
#account ⇒ Object (readonly)
Returns the value of attribute account.
17 18 19 |
# File 'examples/example.rb', line 17 def account @account end |
#auth_level ⇒ Object (readonly)
Returns the value of attribute auth_level.
18 19 20 |
# File 'examples/example.rb', line 18 def auth_level @auth_level end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
19 20 21 |
# File 'examples/example.rb', line 19 def debug @debug end |
#eplf ⇒ Object (readonly)
Returns the value of attribute eplf.
20 21 22 |
# File 'examples/example.rb', line 20 def eplf @eplf end |
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
21 22 23 |
# File 'examples/example.rb', line 21 def interface @interface end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
22 23 24 |
# File 'examples/example.rb', line 22 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
23 24 25 |
# File 'examples/example.rb', line 23 def port @port end |
#read_only ⇒ Object (readonly)
Returns the value of attribute read_only.
24 25 26 |
# File 'examples/example.rb', line 24 def read_only @read_only end |
#session_timeout ⇒ Object (readonly)
Returns the value of attribute session_timeout.
25 26 27 |
# File 'examples/example.rb', line 25 def session_timeout @session_timeout end |
#tls ⇒ Object (readonly)
Returns the value of attribute tls.
26 27 28 |
# File 'examples/example.rb', line 26 def tls @tls end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
27 28 29 |
# File 'examples/example.rb', line 27 def user @user end |