Class: RBS::AST::Members::MethodDefinition
- Inherits:
-
Object
- Object
- RBS::AST::Members::MethodDefinition
- Defined in:
- lib/rbs/ast/members.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#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.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, kind:, types:, annotations:, location:, comment:, attributes:) ⇒ MethodDefinition
constructor
A new instance of MethodDefinition.
- #instance? ⇒ Boolean
- #singleton? ⇒ Boolean
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(name:, kind:, types:, annotations:, location:, comment:, attributes:) ⇒ MethodDefinition
Returns a new instance of MethodDefinition.
13 14 15 16 17 18 19 20 21 |
# File 'lib/rbs/ast/members.rb', line 13 def initialize(name:, kind:, types:, annotations:, location:, comment:, attributes:) @name = name @kind = kind @types = types @annotations = annotations @location = location @comment = comment @attributes = attributes end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
8 9 10 |
# File 'lib/rbs/ast/members.rb', line 8 def annotations @annotations end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/rbs/ast/members.rb', line 11 def attributes @attributes end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
10 11 12 |
# File 'lib/rbs/ast/members.rb', line 10 def comment @comment end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
6 7 8 |
# File 'lib/rbs/ast/members.rb', line 6 def kind @kind end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
9 10 11 |
# File 'lib/rbs/ast/members.rb', line 9 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rbs/ast/members.rb', line 5 def name @name end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
7 8 9 |
# File 'lib/rbs/ast/members.rb', line 7 def types @types end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
23 24 25 26 27 28 29 |
# File 'lib/rbs/ast/members.rb', line 23 def ==(other) other.is_a?(MethodDefinition) && other.name == name && other.kind == kind && other.types == types && other.attributes == attributes end |
#hash ⇒ Object
33 34 35 |
# File 'lib/rbs/ast/members.rb', line 33 def hash self.class.hash ^ name.hash ^ kind.hash ^ types.hash ^ attributes.hash end |
#instance? ⇒ Boolean
37 38 39 |
# File 'lib/rbs/ast/members.rb', line 37 def instance? kind == :instance || kind == :singleton_instance end |
#singleton? ⇒ Boolean
41 42 43 |
# File 'lib/rbs/ast/members.rb', line 41 def singleton? kind == :singleton || kind == :singleton_instance end |
#to_json(*a) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rbs/ast/members.rb', line 45 def to_json(*a) { member: :method_definition, kind: kind, types: types, annotations: annotations, location: location, comment: comment, attributes: attributes }.to_json(*a) end |