Class: ActionviewPrecompiler::RenderParser

Inherits:
Object
  • Object
show all
Defined in:
lib/actionview_precompiler/render_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(code, parser: ASTParser, from_controller: false) ⇒ RenderParser

Returns a new instance of RenderParser.



5
6
7
8
9
# File 'lib/actionview_precompiler/render_parser.rb', line 5

def initialize(code, parser: ASTParser, from_controller: false)
  @code = code
  @parser = parser
  @from_controller = from_controller
end

Instance Method Details

#render_callsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/actionview_precompiler/render_parser.rb', line 11

def render_calls
  render_nodes = @parser.parse_render_nodes(@code)
  render_nodes.map do |method, nodes|
    parse_method = case method
    when :layout
      :parse_layout
    else
      :parse_render
    end

    nodes.map { |n| send(parse_method, n) }
  end.flatten.compact
end