class YARD::Parser::RBS::Statement
Represents a single parsed declaration from an RBS file. Each Statement may have a block of child statements for namespace declarations (class, module, interface).
Attributes
@return [String, nil] RBS type annotation for attrs and constants
@return [Array<Statement>] child statements for namespace blocks
@return [String, nil] adjacent comment text (the docstring)
@return [false] RBS files donโt use ## hash-flag comments
@return [Range, nil] line range of the preceding comments
@return [Integer] 1-indexed line number of this statement
@return [String, nil] mixin name for :include/:extend/:prepend
@return [String] the declaration name
@return [String, nil] aliased method name for :alias
@return [Symbol, nil] :class, :instance or :module (โself?.`) scope
hint from parser
@return [Array<String>] RBS type signature strings for :method_def
Each element is one overload (e.g. "(String name) -> Integer")
@return [String] raw source text of the statement
@return [String, nil] the superclass name (for :class)
@return [Symbol] declaration type:
:class, :module, :interface, :method_def, :attr_reader, :attr_writer, :attr_accessor, :include, :extend, :prepend, :constant, :alias, :visibility
@return [String, nil] aliased class or module name for constants
declared as `class Foo = Bar` or `module Foo = Bar`
@return [Symbol, nil] :public, :private or :protected, from a
visibility modifier on a method or attribute
Public Class Methods
Source
# File lib/yard/parser/rbs/statement.rb, line 64 def initialize(attrs = {}) @type = attrs[:type] @name = attrs[:name] @superclass = attrs[:superclass] @line = attrs[:line] || 1 @source = attrs[:source] || '' @comments = attrs[:comments] @comments_range = attrs[:comments_range] @comments_hash_flag = false @block = attrs[:block] || [] @signatures = attrs[:signatures] || [] @mixin_name = attrs[:mixin_name] @old_name = attrs[:old_name] @attr_rbs_type = attrs[:attr_rbs_type] @value = attrs[:value] @scope = attrs[:scope] @visibility = attrs[:visibility] end
Public Instance Methods
Source
# File lib/yard/parser/rbs/statement.rb, line 84 def show source end
@return [String] a textual snippet used in error messages