Module: PowerAssert
- Defined in:
- lib/power_assert.rb,
lib/power_assert/parser.rb,
lib/power_assert/context.rb,
lib/power_assert/version.rb,
lib/power_assert/inspector.rb,
lib/power_assert/configuration.rb,
lib/power_assert/enable_tracepoint_events.rb
Constant Summary collapse
- VERSION =
"3.0.1"
Class Method Summary collapse
- .app_caller_locations ⇒ Object
- .app_context? ⇒ Boolean
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .start(assertion_proc_or_source, assertion_method: nil, source_binding: TOPLEVEL_BINDING) {|Context.new(assertion_proc_or_source, assertion_method, source_binding)| ... } ⇒ Object
Class Method Details
.app_caller_locations ⇒ Object
35 36 37 |
# File 'lib/power_assert.rb', line 35 def app_caller_locations caller_locations.drop_while {|i| internal_file?(i.path) }.take_while {|i| ! internal_file?(i.path) } end |
.app_context? ⇒ Boolean
39 40 41 42 |
# File 'lib/power_assert.rb', line 39 def app_context? top_frame = caller_locations.drop_while {|i| i.path.start_with?(POWER_ASSERT_LIB_DIR) }.first top_frame and ! internal_file?(top_frame.path) end |
.configuration ⇒ Object
3 4 5 |
# File 'lib/power_assert/configuration.rb', line 3 def configuration @configuration ||= Configuration[false, true, false, :p] end |
.configure {|configuration| ... } ⇒ Object
7 8 9 |
# File 'lib/power_assert/configuration.rb', line 7 def configure yield configuration end |
.start(assertion_proc_or_source, assertion_method: nil, source_binding: TOPLEVEL_BINDING) {|Context.new(assertion_proc_or_source, assertion_method, source_binding)| ... } ⇒ Object
30 31 32 33 |
# File 'lib/power_assert.rb', line 30 def start(assertion_proc_or_source, assertion_method: nil, source_binding: TOPLEVEL_BINDING) clear_global_method_cache yield Context.new(assertion_proc_or_source, assertion_method, source_binding) end |