Class: Fylla::ParsedOption
- Inherits:
-
Object
- Object
- Fylla::ParsedOption
- Defined in:
- lib/fylla/parsed_option.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
used just for parsing class_options recursively.
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#banner ⇒ Object
readonly
used just for parsing class_options recursively.
-
#completion ⇒ Object
readonly
used just for parsing class_options recursively.
-
#description ⇒ Object
Returns the value of attribute description.
-
#enum ⇒ Object
readonly
used just for parsing class_options recursively.
-
#equals_type ⇒ Object
readonly
used just for parsing class_options recursively.
-
#filter ⇒ Object
readonly
used just for parsing class_options recursively.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
readonly
used just for parsing class_options recursively.
Instance Method Summary collapse
-
#initialize(name, description, aliases, enum, filter, type) ⇒ ParsedOption
constructor
A new instance of ParsedOption.
Constructor Details
#initialize(name, description, aliases, enum, filter, type) ⇒ ParsedOption
Returns a new instance of ParsedOption.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fylla/parsed_option.rb', line 8 def initialize(name, description, aliases, enum, filter, type) @name = name @description = description @aliases = aliases # used for switches that take values (everything, but not necessary for boolean) @equals_type = type == :boolean ? "" : "=" @action = "" return unless enum case type when :array @action = if filter %(: :_values -s , 'options' #{enum.join(" ")}) else %(: :_sequence -d compadd - #{enum.join(" ")}) end when :string @action = %|: :(#{enum.join(" ")})| end end |
Instance Attribute Details
#action ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def action @action end |
#aliases ⇒ Object
Returns the value of attribute aliases.
3 4 5 |
# File 'lib/fylla/parsed_option.rb', line 3 def aliases @aliases end |
#banner ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def @banner end |
#completion ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def completion @completion end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/fylla/parsed_option.rb', line 3 def description @description end |
#enum ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def enum @enum end |
#equals_type ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def equals_type @equals_type end |
#filter ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def filter @filter end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/fylla/parsed_option.rb', line 3 def name @name end |
#type ⇒ Object (readonly)
used just for parsing class_options recursively. Don’t ever set these. used for erb file action
6 7 8 |
# File 'lib/fylla/parsed_option.rb', line 6 def type @type end |