Class: RBS::AST::Ruby::Declarations::ClassDecl
- Defined in:
- lib/rbs/ast/ruby/declarations.rb,
sig/ast/ruby/declarations.rbs
Defined Under Namespace
Classes: SuperClass
Instance Attribute Summary collapse
-
#class_name ⇒ TypeName
readonly
Returns the value of attribute class_name.
-
#members ⇒ Array[member]
readonly
Returns the value of attribute members.
-
#node ⇒ Prism::ClassNode
readonly
Returns the value of attribute node.
-
#super_class ⇒ SuperClass?
readonly
Returns the value of attribute super_class.
Attributes inherited from Base
Instance Method Summary collapse
- #each_decl {|arg0| ... } ⇒ Object
-
#initialize(buffer, name, node, super_class) ⇒ ClassDecl
constructor
A new instance of ClassDecl.
- #location ⇒ Location
- #name_location ⇒ Location
- #type_fingerprint ⇒ Object
- #type_params ⇒ Array[AST::TypeParam]
Methods included from Helpers::LocationHelper
Methods included from Helpers::ConstantHelper
constant_as_type_name, #self?.constant_as_type_name
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 ⇒ TypeName (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 ⇒ Array[member] (readonly)
Returns the value of attribute members.
68 69 70 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 68 def members @members end |
#node ⇒ Prism::ClassNode (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 ⇒ SuperClass? (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 ⇒ void #each_decl ⇒ Enumerator[t]
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 ⇒ Location
94 95 96 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 94 def location rbs_location(node.location) end |
#name_location ⇒ Location
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 ⇒ Array[AST::TypeParam]
92 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 92 def type_params = [] |