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.



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

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.



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

def comments_hash_flag
  @comments_hash_flag
end

#fileObject

Returns the value of attribute file.



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

def file
  @file
end

#groupObject

Deprecated.

Groups are now defined by directives



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

def group
  @group
end

#lineObject

Returns the value of attribute line.



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

def line
  @line
end

#sourceObject

Returns the value of attribute source.



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

def source
  @source
end

Instance Method Details

#comments_rangeObject



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

def comments_range
  comments.line_range
end

#first_lineObject



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

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

#line_rangeObject



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

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

#showObject



33
34
35
# File 'lib/yard/parser/c/statement.rb', line 33

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