class RBS::AST::Ruby::Declarations::ClassModuleAliasDecl
Attributes
annotation
[R]
annotation
The infered old name from the right-hand side of the constant declaration
-
nilif the annotation has the type name
node
[R]
node
Public Class Methods
(Buffer, node, TypeName, TypeName?, CommentBlock?, annotation) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/declarations.rb, line 230 def initialize(buffer, node, new_name, infered_old_name, leading_comment, annotation) super(buffer) @node = node @new_name = new_name @infered_old_name = infered_old_name @leading_comment = leading_comment @annotation = annotation end
Calls superclass method
RBS::AST::Ruby::Declarations::Base::new
Public Instance Methods
() → Comment?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/declarations.rb, line 264 def comment leading_comment&.as_comment end
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/declarations.rb, line 239 def location rbs_location(node.location) end
() → Location
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/declarations.rb, line 243 def name_location case node when Prism::ConstantWriteNode rbs_location(node.name_loc) when Prism::ConstantPathWriteNode rbs_location(node.target.location) end end
() → TypeName
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/declarations.rb, line 252 def old_name # Return explicit type name from annotation if provided, otherwise use inferred name case when annotation.type_name annotation.type_name when infered_old_name infered_old_name else raise "No old name available" end end
Returns the old name of the class/module alias
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/ruby/declarations.rb, line 268 def type_fingerprint [ "decls/class_module_alias", annotation.type_fingerprint, new_name.to_s, old_name.to_s, leading_comment&.as_comment&.string ] end