Class: CLASP::Arguments::Option
- Inherits:
-
Object
- Object
- CLASP::Arguments::Option
- Defined in:
- lib/clasp/arguments.rb
Overview
:nodoc: all
Instance Attribute Summary collapse
-
#argument_alias ⇒ Object
readonly
Returns the value of attribute argument_alias.
-
#extras ⇒ Object
readonly
Returns the value of attribute extras.
-
#given_hyphens ⇒ Object
readonly
Returns the value of attribute given_hyphens.
-
#given_index ⇒ Object
readonly
Returns the value of attribute given_index.
-
#given_label ⇒ Object
readonly
Returns the value of attribute given_label.
-
#given_name ⇒ Object
readonly
Returns the value of attribute given_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#==(rhs) ⇒ Object
:nodoc:.
-
#eql?(rhs) ⇒ Boolean
:nodoc:.
-
#hash ⇒ Object
:nodoc:.
-
#initialize(arg, given_index, given_name, resolved_name, argument_alias, given_hyphens, given_label, value, extras) ⇒ Option
constructor
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(arg, given_index, given_name, resolved_name, argument_alias, given_hyphens, given_label, value, extras) ⇒ Option
:nodoc:
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/clasp/arguments.rb', line 124 def initialize(arg, given_index, given_name, resolved_name, argument_alias, given_hyphens, given_label, value, extras) @arg = arg @given_index = given_index @given_name = given_name @argument_alias = argument_alias @given_hyphens = given_hyphens @given_label = given_label @value = value @name = resolved_name || given_name @extras = extras.nil? ? {} : extras end |
Instance Attribute Details
#argument_alias ⇒ Object (readonly)
Returns the value of attribute argument_alias.
139 140 141 |
# File 'lib/clasp/arguments.rb', line 139 def argument_alias @argument_alias end |
#extras ⇒ Object (readonly)
Returns the value of attribute extras.
144 145 146 |
# File 'lib/clasp/arguments.rb', line 144 def extras @extras end |
#given_hyphens ⇒ Object (readonly)
Returns the value of attribute given_hyphens.
140 141 142 |
# File 'lib/clasp/arguments.rb', line 140 def given_hyphens @given_hyphens end |
#given_index ⇒ Object (readonly)
Returns the value of attribute given_index.
137 138 139 |
# File 'lib/clasp/arguments.rb', line 137 def given_index @given_index end |
#given_label ⇒ Object (readonly)
Returns the value of attribute given_label.
141 142 143 |
# File 'lib/clasp/arguments.rb', line 141 def given_label @given_label end |
#given_name ⇒ Object (readonly)
Returns the value of attribute given_name.
138 139 140 |
# File 'lib/clasp/arguments.rb', line 138 def given_name @given_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
142 143 144 |
# File 'lib/clasp/arguments.rb', line 142 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
143 144 145 |
# File 'lib/clasp/arguments.rb', line 143 def value @value end |
Instance Method Details
#==(rhs) ⇒ Object
:nodoc:
158 159 160 161 162 163 164 165 166 |
# File 'lib/clasp/arguments.rb', line 158 def ==(rhs) return false if rhs.nil? if not rhs.instance_of? String rhs = rhs.name end eql? rhs end |
#eql?(rhs) ⇒ Boolean
:nodoc:
147 148 149 150 151 152 153 154 155 |
# File 'lib/clasp/arguments.rb', line 147 def eql?(rhs) return false if rhs.nil? # check name and aliases return true if @name == rhs return argument_alias.aliases.include? rhs if argument_alias false end |
#hash ⇒ Object
:nodoc:
169 170 171 172 |
# File 'lib/clasp/arguments.rb', line 169 def hash @arg.hash end |
#to_s ⇒ Object
:nodoc:
175 176 177 178 |
# File 'lib/clasp/arguments.rb', line 175 def to_s "#{name}=#{value}" end |