123456789_123456789_123456789_123456789_123456789_

Class: ActionView::RenderParser::RipperASTParser::RenderCallExtractor

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, NodeParser, Ripper
Instance Chain:
self, NodeParser, Ripper
Inherits: ActionView::RenderParser::RipperASTParser::NodeParser
Defined in: actionview/lib/action_view/ripper_ast_parser.rb

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(*args) ⇒ RenderCallExtractor

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 152

def initialize(*args)
  super

  @render_calls = []
end

Instance Attribute Details

#render_calls (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 148

attr_reader :render_calls

Instance Method Details

#on_arg_paren(content) (private)

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 177

def on_arg_paren(content)
  content
end

#on_command(name, *args) (private)

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 163

def on_command(name, *args)
  on_render_call(super)
end

#on_fcall(name, *args) (private)

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 159

def on_fcall(name, *args)
  on_render_call(super)
end

#on_paren(content) (private)

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 181

def on_paren(content)
  content.size == 1 ? content.first : content
end

#on_render_call(node) (private)

[ GitHub ]

  
# File 'actionview/lib/action_view/ripper_ast_parser.rb', line 167

def on_render_call(node)
  METHODS_TO_PARSE.each do |method|
    if node.fcall_named?(method)
      @render_calls << [method, node]
      return node
    end
  end
  node
end