Class: RBS::AST::Ruby::Declarations::ClassDecl
- Defined in:
- lib/rbs/ast/ruby/declarations.rb
Defined Under Namespace
Classes: SuperClass
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#members ⇒ Object
readonly
Returns the value of attribute members.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#super_class ⇒ Object
readonly
Returns the value of attribute super_class.
Attributes inherited from Base
Instance Method Summary collapse
- #each_decl(&block) ⇒ Object
-
#initialize(buffer, name, node, super_class) ⇒ ClassDecl
constructor
A new instance of ClassDecl.
- #location ⇒ Object
- #name_location ⇒ Object
- #type_fingerprint ⇒ Object
- #type_params ⇒ Object
Methods included from Helpers::LocationHelper
Methods included from Helpers::ConstantHelper
Constructor Details
#initialize(buffer, name, node, super_class) ⇒ ClassDecl
Returns a new instance of ClassDecl.
74 75 76 77 78 79 80 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 74 def initialize(buffer, name, node, super_class) super(buffer) @class_name = name @node = node @members = [] @super_class = super_class end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
66 67 68 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 66 def class_name @class_name end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
68 69 70 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 68 def members @members end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
70 71 72 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 70 def node @node end |
#super_class ⇒ Object (readonly)
Returns the value of attribute super_class.
72 73 74 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 72 def super_class @super_class end |
Instance Method Details
#each_decl(&block) ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 82 def each_decl(&block) return enum_for(:each_decl) unless block @members.each do |member| if member.is_a?(Base) yield member end end end |
#location ⇒ Object
94 95 96 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 94 def location rbs_location(node.location) end |
#name_location ⇒ Object
98 99 100 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 98 def name_location rbs_location(node.constant_path.location) end |
#type_fingerprint ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 102 def type_fingerprint result = [] #: Array[untyped] result << "decls/class" result << class_name.to_s result << super_class&.type_fingerprint result << members.map { _1.type_fingerprint } result end |
#type_params ⇒ Object
92 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 92 def type_params = [] |