class PowerAssert::Parser

Constants

AND_OR_OPS
DUMMY
Ident
MID2SRCTXT

Attributes

binding[R]
line[R]
lineno[R]
path[R]

Public Class Methods

new(line, path, lineno, binding, assertion_method_name = nil) click to toggle source
# File lib/power_assert/parser.rb, line 9
def initialize(line, path, lineno, binding, assertion_method_name = nil)
  @line = line
  @line_for_parsing = valid_syntax?(line) ? line : slice_expression(line)
  @path = path
  @lineno = lineno
  @binding = binding
  @proc_local_variables = binding.eval('local_variables').map(&:to_s)
  @assertion_method_name = assertion_method_name
end

Public Instance Methods

call_paths() click to toggle source
# File lib/power_assert/parser.rb, line 23
def call_paths
  collect_paths(idents).uniq
end
idents() click to toggle source
# File lib/power_assert/parser.rb, line 19
def idents
  @idents ||= extract_idents(Ripper.sexp(@line_for_parsing))
end
method_id_set() click to toggle source
# File lib/power_assert/parser.rb, line 27
def method_id_set
  methods = idents.flatten.find_all {|i| i.type == :method }
  @method_id_set ||= methods.map(&:name).map(&:to_sym).each_with_object({}) {|i, h| h[i] = true }
end