Class: CLASP::Arguments::Flag
- Inherits:
-
Object
- Object
- CLASP::Arguments::Flag
- 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.
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, extras) ⇒ Flag
constructor
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(arg, given_index, given_name, resolved_name, argument_alias, given_hyphens, given_label, extras) ⇒ Flag
:nodoc:
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/clasp/arguments.rb', line 67 def initialize(arg, given_index, given_name, resolved_name, argument_alias, given_hyphens, given_label, extras) @arg = arg @given_index = given_index @given_name = given_name @argument_alias = argument_alias @given_hyphens = given_hyphens @given_label = given_label @name = resolved_name || given_name @extras = extras.nil? ? {} : extras end |
Instance Attribute Details
#argument_alias ⇒ Object (readonly)
Returns the value of attribute argument_alias.
81 82 83 |
# File 'lib/clasp/arguments.rb', line 81 def argument_alias @argument_alias end |
#extras ⇒ Object (readonly)
Returns the value of attribute extras.
85 86 87 |
# File 'lib/clasp/arguments.rb', line 85 def extras @extras end |
#given_hyphens ⇒ Object (readonly)
Returns the value of attribute given_hyphens.
82 83 84 |
# File 'lib/clasp/arguments.rb', line 82 def given_hyphens @given_hyphens end |
#given_index ⇒ Object (readonly)
Returns the value of attribute given_index.
79 80 81 |
# File 'lib/clasp/arguments.rb', line 79 def given_index @given_index end |
#given_label ⇒ Object (readonly)
Returns the value of attribute given_label.
83 84 85 |
# File 'lib/clasp/arguments.rb', line 83 def given_label @given_label end |
#given_name ⇒ Object (readonly)
Returns the value of attribute given_name.
80 81 82 |
# File 'lib/clasp/arguments.rb', line 80 def given_name @given_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
84 85 86 |
# File 'lib/clasp/arguments.rb', line 84 def name @name end |
Instance Method Details
#==(rhs) ⇒ Object
:nodoc:
105 106 107 108 109 110 111 112 113 |
# File 'lib/clasp/arguments.rb', line 105 def ==(rhs) return false if rhs.nil? if not rhs.instance_of? String rhs = rhs.name end eql? rhs end |
#eql?(rhs) ⇒ Boolean
:nodoc:
94 95 96 97 98 99 100 101 102 |
# File 'lib/clasp/arguments.rb', line 94 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:
116 117 118 119 |
# File 'lib/clasp/arguments.rb', line 116 def hash @arg.hash end |
#to_s ⇒ Object
:nodoc:
88 89 90 91 |
# File 'lib/clasp/arguments.rb', line 88 def to_s @name end |