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

Inherits:
  Object
  - Object
  - YARD::Parser::C::Statement
  show all

Defined in:
  lib/yard/parser/c/statement.rb

## Direct Known Subclasses

BodyStatement, Comment, ToplevelStatement

## Instance Attribute Summary collapse

- #comments_hash_flag ⇒ Object

  Returns the value of attribute comments_hash_flag.

- #file ⇒ Object

  Returns the value of attribute file.

- #group ⇒ Object deprecated Deprecated.

  Groups are now defined by directives

- #line ⇒ Object

  Returns the value of attribute line.

- #source ⇒ Object

  Returns the value of attribute source.

## Instance Method Summary collapse

- #comments_range ⇒ Object
- #first_line ⇒ Object (also: #signature)
- #initialize(source, file = nil, line = nil) ⇒ Statement constructor

  A new instance of Statement.

- #line_range ⇒ Object
- #show ⇒ Object

## 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_flag ⇒ `Object`

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

### #file ⇒ `Object`

Returns the value of attribute file.

    8
    9
    10

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

    def file
      @file
    end

### #group ⇒ `Object`

Deprecated.

Groups are now defined by directives

See Also:

- Tags::GroupDirective

    12
    13
    14

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

    def group
      @group
    end

### #line ⇒ `Object`

Returns the value of attribute line.

    7
    8
    9

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

    def line
      @line
    end

### #source ⇒ `Object`

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_range ⇒ `Object`

    26
    27
    28

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

    def comments_range
      comments.line_range
    end

### #first_line ⇒ `Object` 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_range ⇒ `Object`

    22
    23
    24

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

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

### #show ⇒ `Object`

    36
    37
    38

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

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