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 191

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 = open(path).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 213

def enabled?
  @trace_return.enabled?
end

Instance Method Details

#disable

[ GitHub ]

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

def disable
  @trace_return.disable
end

#enable

[ GitHub ]

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

def enable
  @fired = true
  @trace_return.enable
end