class PowerAssert::TraceContext

Public Class Methods

new(binding) click to toggle source
Calls superclass method PowerAssert::Context.new
# File lib/power_assert/context.rb, line 208
def initialize(binding)
  target_frame, *base = PowerAssert.app_caller_locations
  super(base.length)
  path = target_frame.path
  lineno = target_frame.lineno
  if File.exist?(path)
    line = File.open(path) {|fp| fp.each_line.drop(lineno - 1).first }
    @parser = Parser.new(line, path, lineno, binding)
  else
    @parser = Parser::DUMMY
  end
end

Public Instance Methods

disable() click to toggle source
# File lib/power_assert/context.rb, line 226
def disable
  @trace_return.disable
end
enable() click to toggle source
# File lib/power_assert/context.rb, line 221
def enable
  @fired = true
  @trace_return.enable
end
enabled?() click to toggle source
# File lib/power_assert/context.rb, line 230
def enabled?
  @trace_return.enabled?
end