Class: Falkor::Yard::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/falkor/yard/parser.rb,
lib/falkor/yard/parser/global_state.rb

Defined Under Namespace

Classes: GlobalState

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_state, files) ⇒ Parser

Returns a new instance of Parser.



11
12
13
14
15
# File 'lib/falkor/yard/parser.rb', line 11

def initialize(global_state, files)
  @global_state = global_state || GlobalState.new(self, 0)

  @files = files.dup
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



9
10
11
# File 'lib/falkor/yard/parser.rb', line 9

def files
  @files
end

#global_stateObject

Returns the value of attribute global_state.



9
10
11
# File 'lib/falkor/yard/parser.rb', line 9

def global_state
  @global_state
end

Instance Method Details

#parseObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/falkor/yard/parser.rb', line 17

def parse
  global_state.block = Proc.new if block_given?

  until files.empty?
    file = files.shift
    YARD::Parser::SourceParser.new(
      YARD::Parser::SourceParser.parser_type, global_state
    ).parse(file)

    global_state.processed(file)
  end
end