Class: Tins::MethodDescription::Signature
- Defined in:
- lib/tins/method_description.rb
Overview
Represents the signature of a method including all its parameters.
Instance Attribute Summary collapse
-
#parameters ⇒ Array<Parameters::Parameter>
readonly
Returns the parameters associated with this signature.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Checks if two signatures are equal (alias for eql?).
-
#===(method) ⇒ Boolean
Pattern matching operator for comparing with a method’s signature.
-
#eql?(other) ⇒ Boolean
Checks if two signatures are equal based on their parameters.
-
#initialize(*parameters) ⇒ Signature
constructor
Initializes a new signature with given parameters.
-
#inspect ⇒ String
Returns a detailed string representation for debugging.
-
#to_s ⇒ String
Converts the signature to a comma-separated string.
Constructor Details
#initialize(*parameters) ⇒ Signature
Initializes a new signature with given parameters.
130 131 132 |
# File 'lib/tins/method_description.rb', line 130 def initialize(*parameters) @parameters = parameters end |
Instance Attribute Details
#parameters ⇒ Array<Parameters::Parameter> (readonly)
Returns the parameters associated with this signature.
137 138 139 |
# File 'lib/tins/method_description.rb', line 137 def parameters @parameters end |
Instance Method Details
#==(other) ⇒ Boolean
Checks if two signatures are equal (alias for eql?).
151 152 153 |
# File 'lib/tins/method_description.rb', line 151 def ==(other) @parameters == other.parameters end |
#===(method) ⇒ Boolean
Pattern matching operator for comparing with a method’s signature.
159 160 161 |
# File 'lib/tins/method_description.rb', line 159 def ===(method) self == method.signature end |
#eql?(other) ⇒ Boolean
Checks if two signatures are equal based on their parameters.
143 144 145 |
# File 'lib/tins/method_description.rb', line 143 def eql?(other) @parameters.eql? other.parameters end |
#inspect ⇒ String
Returns a detailed string representation for debugging.
173 174 175 |
# File 'lib/tins/method_description.rb', line 173 def inspect "#<#{self.class} (#{to_s})>" end |
#to_s ⇒ String
Converts the signature to a comma-separated string.
166 167 168 |
# File 'lib/tins/method_description.rb', line 166 def to_s @parameters * ?, end |