Class: Mida::DataType::Boolean
- Defined in:
- lib/mida/datatype/boolean.rb
Overview
Boolean data type Provides access to TrueClass/FalseClass methods
Instance Method Summary collapse
- #!@ ⇒ Object
-
#initialize(value) ⇒ Boolean
constructor
Raises
ArgumentError
if value not valid boolean. - #to_s ⇒ Object
Methods inherited from Generic
#==, #method_missing, parse, #to_yaml
Constructor Details
#initialize(value) ⇒ Boolean
Raises ArgumentError
if value not valid boolean
11 12 13 14 15 16 17 |
# File 'lib/mida/datatype/boolean.rb', line 11 def initialize(value) @parsedValue = case value.downcase when 'true' then true when 'false' then false else raise ::ArgumentError, 'Invalid value' end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Mida::DataType::Generic
Instance Method Details
#!@ ⇒ Object
23 24 25 |
# File 'lib/mida/datatype/boolean.rb', line 23 def !@ !@parsedValue end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/mida/datatype/boolean.rb', line 19 def to_s @parsedValue.to_s.capitalize end |