class YARD::Parser::Ruby::Legacy::Statement
Attributes
@deprecated Groups are now defined by directives @see Tags::GroupDirective
Public Class Methods
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 14 def initialize(tokens, block = nil, comments = nil) @tokens = tokens @block = block @comments = comments @comments_hash_flag = false end
Public Instance Methods
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 21 def first_line to_s.split(/\n/)[0] end
Also aliased as: signature
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 34 def inspect l = line - 1 to_s(false).split(/\n/).map do |text| "\t#{l += 1}: #{text}" end.join("\n") end
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 46 def line tokens.first.line_no end
@return [Fixnum] the first line of Ruby
source
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 52 def line_range tokens.first.line_no..tokens.last.line_no end
@return [Range<Fixnum>] the first to last lines of Ruby
source @since 0.5.4
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 41 def show "\t#{line}: #{first_line}" end
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 27 def to_s(include_block = true) tokens.map do |token| RubyToken::TkBlockContents === token ? (include_block ? block.to_s : '') : token.text end.join end
Also aliased as: source
Private Instance Methods
Source
# File lib/yard/parser/ruby/legacy/statement.rb, line 58 def clean_tokens(tokens) last_tk = nil tokens.reject do |tk| tk.is_a?(RubyToken::TkNL) || (last_tk.is_a?(RubyToken::TkSPACE) && last_tk.class == tk.class) && last_tk = tk end end