Class: RBS::AST::Ruby::Declarations::ModuleDecl
- Defined in:
- lib/rbs/ast/ruby/declarations.rb
Instance Attribute Summary collapse
-
#members ⇒ Object
readonly
Returns the value of attribute members.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Attributes inherited from Base
Instance Method Summary collapse
- #each_decl(&block) ⇒ Object
-
#initialize(buffer, name, node) ⇒ ModuleDecl
constructor
A new instance of ModuleDecl.
- #location ⇒ Object
- #name_location ⇒ Object
- #self_types ⇒ Object
- #type_fingerprint ⇒ Object
- #type_params ⇒ Object
Methods included from Helpers::LocationHelper
Methods included from Helpers::ConstantHelper
Constructor Details
#initialize(buffer, name, node) ⇒ ModuleDecl
Returns a new instance of ModuleDecl.
121 122 123 124 125 126 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 121 def initialize(buffer, name, node) super(buffer) @module_name = name @node = node @members = [] end |
Instance Attribute Details
#members ⇒ Object (readonly)
Returns the value of attribute members.
117 118 119 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 117 def members @members end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
115 116 117 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 115 def module_name @module_name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
119 120 121 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 119 def node @node end |
Instance Method Details
#each_decl(&block) ⇒ Object
128 129 130 131 132 133 134 135 136 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 128 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
142 143 144 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 142 def location rbs_location(node.location) end |
#name_location ⇒ Object
146 147 148 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 146 def name_location rbs_location(node.constant_path.location) end |
#self_types ⇒ Object
140 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 140 def self_types = [] |
#type_fingerprint ⇒ Object
150 151 152 153 154 155 156 157 158 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 150 def type_fingerprint result = [] #: Array[untyped] result << "decls/module" result << module_name.to_s result << members.map { _1.type_fingerprint} result end |
#type_params ⇒ Object
138 |
# File 'lib/rbs/ast/ruby/declarations.rb', line 138 def type_params = [] |