Class: OBIX::Types::Boolean
Instance Method Summary collapse
-
#cast(value) ⇒ Object
Cast the given value to a boolean.
Methods inherited from Type
Constructor Details
This class inherits a constructor from OBIX::Types::Type
Instance Method Details
#cast(value) ⇒ Object
Cast the given value to a boolean.
value - A string that is either “true” or “false”.
Returns a boolean.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/obix/types/boolean.rb', line 11 def cast value case value when "true" true when "false" false else raise StandardError, "Could not cast #{value} to a boolean" end end |