Class: ArgvParser::Option
Instance Attribute Summary
#block, #comment, #conditions, #option_is_boolean, #option_name, #short_option_name, #value_is_optional, #value_may_be_array, #value_name
Instance Method Summary
collapse
#display
Constructor Details
#initialize(short_option_name, option_name, option_is_boolean, value_is_optional, value_may_be_array, value_name, comment, conditions, block) ⇒ Option
Returns a new instance of Option.
45
46
47
48
49
50
51
|
# File 'lib/ruby-process-controller/argv_parser.rb', line 45
def initialize short_option_name, option_name, option_is_boolean, value_is_optional, value_may_be_array, value_name, , conditions, block
super option_name, value_is_optional, value_may_be_array, , conditions, block
@short_option_name = short_option_name
@option_is_boolean = option_is_boolean
@value_name = value_name
end
|
Instance Method Details
#columnized_display ⇒ Object
69
70
71
|
# File 'lib/ruby-process-controller/argv_parser.rb', line 69
def columnized_display
[display_short_name, display_name, display_value, ]
end
|
#display_name ⇒ Object
57
58
59
|
# File 'lib/ruby-process-controller/argv_parser.rb', line 57
def display_name
"--#{"[no-]" if option_is_boolean}#{option_name}" if option_name
end
|
#display_names ⇒ Object
53
54
55
|
# File 'lib/ruby-process-controller/argv_parser.rb', line 53
def display_names
[display_short_name, display_name].compact * "/"
end
|
#display_short_name ⇒ Object
61
62
63
|
# File 'lib/ruby-process-controller/argv_parser.rb', line 61
def display_short_name
"-#{short_option_name}" if short_option_name
end
|
#display_value ⇒ Object
65
66
67
|
# File 'lib/ruby-process-controller/argv_parser.rb', line 65
def display_value
"#{"[" if value_is_optional}#{value_name}#{"]" if value_is_optional}#{"..." if value_may_be_array}"
end
|