Class: RBS::AST::Members::MethodDefinition
- Defined in:
- lib/rbs/ast/members.rb
Defined Under Namespace
Classes: Overload
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#overloading ⇒ Object
readonly
Returns the value of attribute overloading.
-
#overloads ⇒ Object
readonly
Returns the value of attribute overloads.
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, kind:, overloads:, annotations:, location:, comment:, overloading:, visibility:) ⇒ MethodDefinition
constructor
A new instance of MethodDefinition.
- #instance? ⇒ Boolean
- #overloading? ⇒ Boolean
- #singleton? ⇒ Boolean
- #to_json(state = _ = nil) ⇒ Object
- #update(name: self.name, kind: self.kind, overloads: self.overloads, annotations: self.annotations, location: self.location, comment: self.comment, overloading: self.overloading?, visibility: self.visibility) ⇒ Object
Constructor Details
#initialize(name:, kind:, overloads:, annotations:, location:, comment:, overloading:, visibility:) ⇒ MethodDefinition
Returns a new instance of MethodDefinition.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rbs/ast/members.rb', line 53 def initialize(name:, kind:, overloads:, annotations:, location:, comment:, overloading:, visibility:) @name = name @kind = kind @overloads = overloads @annotations = annotations @location = location @comment = comment @overloading = overloading @visibility = visibility end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
47 48 49 |
# File 'lib/rbs/ast/members.rb', line 47 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
49 50 51 |
# File 'lib/rbs/ast/members.rb', line 49 def comment @comment end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
45 46 47 |
# File 'lib/rbs/ast/members.rb', line 45 def kind @kind end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
48 49 50 |
# File 'lib/rbs/ast/members.rb', line 48 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
44 45 46 |
# File 'lib/rbs/ast/members.rb', line 44 def name @name end |
#overloading ⇒ Object (readonly)
Returns the value of attribute overloading.
50 51 52 |
# File 'lib/rbs/ast/members.rb', line 50 def overloading @overloading end |
#overloads ⇒ Object (readonly)
Returns the value of attribute overloads.
46 47 48 |
# File 'lib/rbs/ast/members.rb', line 46 def overloads @overloads end |
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
51 52 53 |
# File 'lib/rbs/ast/members.rb', line 51 def visibility @visibility end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
64 65 66 67 68 69 70 71 |
# File 'lib/rbs/ast/members.rb', line 64 def ==(other) other.is_a?(MethodDefinition) && other.name == name && other.kind == kind && other.overloads == overloads && other.overloading? == overloading? && other.visibility == visibility end |
#hash ⇒ Object
75 76 77 |
# File 'lib/rbs/ast/members.rb', line 75 def hash name.hash ^ kind.hash ^ overloads.hash ^ overloading?.hash ^ visibility.hash end |
#instance? ⇒ Boolean
79 80 81 |
# File 'lib/rbs/ast/members.rb', line 79 def instance? kind == :instance || kind == :singleton_instance end |
#overloading? ⇒ Boolean
87 88 89 |
# File 'lib/rbs/ast/members.rb', line 87 def overloading? overloading end |
#singleton? ⇒ Boolean
83 84 85 |
# File 'lib/rbs/ast/members.rb', line 83 def singleton? kind == :singleton || kind == :singleton_instance end |
#to_json(state = _ = nil) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/rbs/ast/members.rb', line 104 def to_json(state = _ = nil) { member: :method_definition, name: name, kind: kind, overloads: overloads, annotations: annotations, location: location, comment: comment, overloading: overloading?, visibility: visibility }.to_json(state) end |
#update(name: self.name, kind: self.kind, overloads: self.overloads, annotations: self.annotations, location: self.location, comment: self.comment, overloading: self.overloading?, visibility: self.visibility) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/rbs/ast/members.rb', line 91 def update(name: self.name, kind: self.kind, overloads: self.overloads, annotations: self.annotations, location: self.location, comment: self.comment, overloading: self.overloading?, visibility: self.visibility) self.class.new( name: name, kind: kind, overloads: overloads, annotations: annotations, location: location, comment: comment, overloading: overloading, visibility: visibility ) end |