Class: RBS::AST::Members::MethodDefinition::Overload
- Inherits:
-
Object
- Object
- RBS::AST::Members::MethodDefinition::Overload
- Defined in:
- lib/rbs/ast/members.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
-
#method_type ⇒ Object
readonly
Returns the value of attribute method_type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(method_type:, annotations:) ⇒ Overload
constructor
A new instance of Overload.
- #sub(subst) ⇒ Object
- #to_json(state = _ = nil) ⇒ Object
- #update(annotations: self.annotations, method_type: self.method_type) ⇒ Object
Constructor Details
#initialize(method_type:, annotations:) ⇒ Overload
Returns a new instance of Overload.
13 14 15 16 |
# File 'lib/rbs/ast/members.rb', line 13 def initialize(method_type:, annotations:) @method_type = method_type @annotations = annotations end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
11 12 13 |
# File 'lib/rbs/ast/members.rb', line 11 def annotations @annotations end |
#method_type ⇒ Object (readonly)
Returns the value of attribute method_type.
11 12 13 |
# File 'lib/rbs/ast/members.rb', line 11 def method_type @method_type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
18 19 20 |
# File 'lib/rbs/ast/members.rb', line 18 def ==(other) other.is_a?(Overload) && other.method_type == method_type && other.annotations == annotations end |
#hash ⇒ Object
22 23 24 |
# File 'lib/rbs/ast/members.rb', line 22 def hash method_type.hash ^ annotations.hash end |
#sub(subst) ⇒ Object
32 33 34 |
# File 'lib/rbs/ast/members.rb', line 32 def sub(subst) update(method_type: self.method_type.sub(subst)) end |
#to_json(state = _ = nil) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/rbs/ast/members.rb', line 36 def to_json(state = _ = nil) { annotations: annotations, method_type: method_type }.to_json(state) end |