Module: Yarbf::BooleanJudge
- Included in:
- BfInterpreter
- Defined in:
- lib/yarbf.rb
Instance Method Summary collapse
-
#is_boolean?(obj, &block) ⇒ Boolean
Determines and returns whether an object is a boolean value.
-
#not_boolean?(obj, &block) ⇒ Boolean
Determines and returns whether an object is not a boolean value.
Instance Method Details
#is_boolean?(obj, &block) ⇒ Boolean
Determines and returns whether an object is a boolean value.
obj
-
An #Object.
- &block
-
A block to call when true.
19 20 21 22 23 |
# File 'lib/yarbf.rb', line 19 def is_boolean?(obj, &block) result = [true, false].include?(obj) yield if result && !block.nil? result end |
#not_boolean?(obj, &block) ⇒ Boolean
Determines and returns whether an object is not a boolean value.
obj
-
An #Object.
- &block
-
A block to call when true.
31 32 33 34 35 |
# File 'lib/yarbf.rb', line 31 def not_boolean?(obj, &block) result = [true, false].include?(obj) yield unless result || block.nil? result end |