module IfTest

W3MUtils depend: w3m
iftest

Test mode. Returns a temporary value when unit-testing.

Attributes

test_mode[RW]

Set true when unit-testing.

test_mode?[RW]

Set true when unit-testing.

Public Instance Methods

if_test(test_value, non_test_value=nil, &block) click to toggle source

Returns a temporary value when unit-testing.

# 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