In Files

  • power_assert-1.1.7/lib/power_assert/parser.rb

PowerAssert::Parser

Attributes

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

Public Class Methods

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

Public Instance Methods

call_paths() click to toggle source
 
               # File power_assert-1.1.7/lib/power_assert/parser.rb, line 24
def call_paths
  collect_paths(idents).uniq
end
            
idents() click to toggle source
 
               # File power_assert-1.1.7/lib/power_assert/parser.rb, line 20
def idents
  @idents ||= extract_idents(Ripper.sexp(@line_for_parsing))
end
            
method_id_set() click to toggle source
 
               # File power_assert-1.1.7/lib/power_assert/parser.rb, line 28
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