Class: YARD::Parser::C::Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/parser/c/statement.rb

Direct Known Subclasses

BodyStatement, Comment, ToplevelStatement

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, file = nil, line = nil) ⇒ Statement

Returns a new instance of Statement.



16
17
18
19
20
# File 'lib/yard/parser/c/statement.rb', line 16

def initialize(source, file = nil, line = nil)
  @source = source
  @file = file
  @line = line
end

Instance Attribute Details

#comments_hash_flagObject

Returns the value of attribute comments_hash_flag.



14
15
16
# File 'lib/yard/parser/c/statement.rb', line 14

def comments_hash_flag
  @comments_hash_flag
end

#fileObject

Returns the value of attribute file.



8
9
10
# File 'lib/yard/parser/c/statement.rb', line 8

def file
  @file
end

#groupObject

Deprecated.

Groups are now defined by directives



12
13
14
# File 'lib/yard/parser/c/statement.rb', line 12

def group
  @group
end

#lineObject

Returns the value of attribute line.



7
8
9
# File 'lib/yard/parser/c/statement.rb', line 7

def line
  @line
end

#sourceObject

Returns the value of attribute source.



6
7
8
# File 'lib/yard/parser/c/statement.rb', line 6

def source
  @source
end

Instance Method Details

#comments_rangeObject



26
27
28
# File 'lib/yard/parser/c/statement.rb', line 26

def comments_range
  comments.line_range
end

#first_lineObject Also known as: signature



30
31
32
# File 'lib/yard/parser/c/statement.rb', line 30

def first_line
  source.split(/\n/).first
end

#line_rangeObject



22
23
24
# File 'lib/yard/parser/c/statement.rb', line 22

def line_range
  line...(line + source.count("\n"))
end

#showObject



36
37
38
# File 'lib/yard/parser/c/statement.rb', line 36

def show
  "\t#{line}: #{first_line}"
end