class FuckItRuby::FuckProcessor
Attributes
locations[R]
Public Class Methods
new(method_label, from, whole_file, *args)
click to toggle source
Calls superclass method
# File lib/fuckitruby/fuck_processor.rb, line 7 def initialize(method_label, from, whole_file, *args) @method_label = method_label @from = from @whole_file = whole_file @locations = [] super *args end
Public Instance Methods
handler_missing(node)
click to toggle source
# File lib/fuckitruby/fuck_processor.rb, line 19 def handler_missing(node) process_all(node.children.select { |c| c.is_a?(AST::Node) }) end
mark_local(node)
click to toggle source
# File lib/fuckitruby/fuck_processor.rb, line 40 def mark_local(node) if (@whole_file || @itshappening) && node.children[0] == @from @locations << [node.location.expression.begin_pos, node.location.expression.end_pos] end node end
on_begin(node)
click to toggle source
# File lib/fuckitruby/fuck_processor.rb, line 15 def on_begin(node) process_all node end
on_def(node)
click to toggle source
# File lib/fuckitruby/fuck_processor.rb, line 23 def on_def(node) if !@whole_file && node.children[0] == @method_label @itshappening = true node.children[1..-1].each &method(:process) @itshappening = false elsif @whole_file && node.children[0] == @from @locations << [node.location.name.begin_pos, node.location.name.end_pos] node.children[1..-1].each &method(:process) end end
on_lvasgn(node)
click to toggle source
# File lib/fuckitruby/fuck_processor.rb, line 34 def on_lvasgn(node) if (@whole_file || @itshappening) && node.children[0] == @from @locations << [node.location.name.begin_pos, node.location.name.end_pos] end end
on_send(node)
click to toggle source
# File lib/fuckitruby/fuck_processor.rb, line 50 def on_send(node) if (@whole_file || @itshappening) && node.children[1] == @from #&& node.children[0].nil? @locations << [node.location.selector.begin_pos, node.location.selector.end_pos] end end