Class: YARD::Parser::Ruby::Legacy::Statement
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/yard/parser/ruby/legacy/statement.rb |
Class Method Summary
Instance Attribute Summary
- #block readonly
- #comments readonly
- #comments_hash_flag rw
- #comments_range rw
-
#group
rw
deprecated
Deprecated.
Groups are now defined by directives
- #tokens readonly
Instance Method Summary
- #first_line (also: #signature)
- #inspect
- #line ⇒ Fixnum
- #line_range ⇒ Range<Fixnum>
- #show
-
#signature
Alias for #first_line.
-
#source(include_block = true)
Alias for #to_s.
- #to_s(include_block = true) (also: #source)
- #clean_tokens(tokens) private
Constructor Details
.new(tokens, block = nil, comments = nil) ⇒ Statement
Instance Attribute Details
#block (readonly)
[ GitHub ]#comments (readonly)
[ GitHub ]#comments_hash_flag (rw)
[ GitHub ]# File 'lib/yard/parser/ruby/legacy/statement.rb', line 12
attr_accessor :comments_hash_flag
#comments_range (rw)
[ GitHub ]# File 'lib/yard/parser/ruby/legacy/statement.rb', line 6
attr_accessor :comments_range
#group (rw)
Deprecated.
Groups are now defined by directives
# File 'lib/yard/parser/ruby/legacy/statement.rb', line 10
attr_accessor :group
#tokens (readonly)
[ GitHub ]Instance Method Details
#clean_tokens(tokens) (private)
[ GitHub ]#first_line Also known as: #signature
[ GitHub ]# File 'lib/yard/parser/ruby/legacy/statement.rb', line 21
def first_line to_s.split(/\n/)[0] end
#inspect
[ GitHub ]
#line ⇒ Fixnum
# File 'lib/yard/parser/ruby/legacy/statement.rb', line 46
def line tokens.first.line_no end
#line_range ⇒ Range
<Fixnum
>
#show
[ GitHub ]# File 'lib/yard/parser/ruby/legacy/statement.rb', line 41
def show "\t#{line}: #{first_line}" end
#signature
Alias for #first_line.
# File 'lib/yard/parser/ruby/legacy/statement.rb', line 25
alias signature first_line
#source(include_block = true)
Alias for #to_s.
# File 'lib/yard/parser/ruby/legacy/statement.rb', line 32
alias source to_s
#to_s(include_block = true) Also known as: #source
[ GitHub ]# 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