123456789_123456789_123456789_123456789_123456789_

Class: PowerAssert::TraceContext

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Context
Instance Chain:
self, Context
Inherits: PowerAssert::Context
Defined in: lib/power_assert/context.rb

Class Method Summary

Instance Attribute Summary

Context - Inherited

Instance Method Summary

Constructor Details

.new(binding) ⇒ TraceContext

[ GitHub ]

  
# File 'lib/power_assert/context.rb', line 211

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

Instance Attribute Details

#enabled?Boolean (readonly)

[ GitHub ]

  
# File 'lib/power_assert/context.rb', line 233

def enabled?
  @trace_return.enabled?
end

Instance Method Details

#disable

[ GitHub ]

  
# File 'lib/power_assert/context.rb', line 229

def disable
  @trace_return.disable
end

#enable

[ GitHub ]

  
# File 'lib/power_assert/context.rb', line 224

def enable
  @fired = true
  @trace_return.enable
end