Class: Factbase::Boolean
- Inherits:
-
Object
- Object
- Factbase::Boolean
- Defined in:
- lib/factbase/terms/boolean.rb
Overview
Boolean value checker.
Instance Method Summary collapse
-
#bool? ⇒ Boolean
The boolean value.
-
#initialize(val, from) ⇒ Boolean
constructor
Constructor.
Constructor Details
#initialize(val, from) ⇒ Boolean
Constructor.
14 15 16 17 |
# File 'lib/factbase/terms/boolean.rb', line 14 def initialize(val, from) @val = val @from = from end |
Instance Method Details
#bool? ⇒ Boolean
Returns The boolean value.
21 22 23 24 25 26 27 |
# File 'lib/factbase/terms/boolean.rb', line 21 def bool? val = @val val = val[0] if val.respond_to?(:each) return false if val.nil? return val if val.is_a?(TrueClass) || val.is_a?(FalseClass) raise "Boolean is expected, while #{val.class} received from #{@from}" end |