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 [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
@return [Symbol, nil] :class or :instance scope hint from parser
Public Class Methods
Source
# File lib/yard/parser/rbs/statement.rb, line 52 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] @attr_rbs_type = attrs[:attr_rbs_type] @visibility = attrs[:visibility] end
Public Instance Methods
Source
# File lib/yard/parser/rbs/statement.rb, line 69 def show source end
@return [String] a textual snippet used in error messages