class CutePrint::RubyParser::ParsedCode

How this class works is cribbed this excellent code:

https://github.com/sconover/wrong/blob/30475fc5ac9d0f73135d229b1b44c045156a7e7a/lib/wrong/d.rb

@api private

Public Instance Methods

first_call_to_method(method_name) click to toggle source
# File lib/cute_print/ruby_parser/parsed_code.rb, line 17
def first_call_to_method(method_name)
  MethodCall.new(method_call_node(method_name))
end

Private Instance Methods

method_call_node(method_name) click to toggle source
# File lib/cute_print/ruby_parser/parsed_code.rb, line 23
def method_call_node(method_name)
  if MethodCall.call_to_method?(@sexp, method_name)
    return @sexp
  end
  @sexp.each_sexp do |node|
    if MethodCall.call_to_method?(node, method_name)
      return node
    end
  end
  raise "Method call not found"
end