Module: IfTest
- Defined in:
- lib/el4r/el4r-sub.rb
Overview
W3MUtils depend: w3m iftestTest mode. Returns a temporary value when unit-testing.
Instance Attribute Summary collapse
-
#test_mode ⇒ Object
(also: #test_mode?)
Set true when unit-testing.
Instance Method Summary collapse
-
#if_test(test_value, non_test_value = nil, &block) ⇒ Object
Returns a temporary value when unit-testing.
Instance Attribute Details
#test_mode ⇒ Object Also known as: test_mode?
Set true when unit-testing.
445 446 447 |
# File 'lib/el4r/el4r-sub.rb', line 445 def test_mode @test_mode end |
Instance Method Details
#if_test(test_value, non_test_value = nil, &block) ⇒ Object
Returns a temporary value when unit-testing.
450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/el4r/el4r-sub.rb', line 450 def if_test(test_value, non_test_value=nil, &block) if self.test_mode? test_value else if block block.call else non_test_value end end end |