Module: Lotus::Model::Mapping::Coercions
- Defined in:
- lib/lotus/model/mapping/coercions.rb
Overview
Coercions utilities
Class Method Summary collapse
-
.Array(arg) ⇒ Array
Coerce into an Array, unless the argument is nil.
-
.BigDecimal(arg) ⇒ BigDecimal
Coerce into a BigDecimal, unless the argument is nil.
-
.Boolean(arg) ⇒ Boolean
Coerce into a Boolean, unless the argument is nil.
-
.Date(arg) ⇒ Date
Coerce into a Date, unless the argument is nil.
-
.DateTime(arg) ⇒ DateTime
Coerce into a DateTime, unless the argument is nil.
-
.Float(arg) ⇒ Float
Coerce into a Float, unless the argument is nil.
-
.Hash(arg) ⇒ Hash
Coerce into a Hash, unless the argument is nil.
-
.Integer(arg) ⇒ Integer
Coerce into an Integer, unless the argument is nil.
-
.Set(arg) ⇒ Set
Coerce into a Set, unless the argument is nil.
-
.String(arg) ⇒ String
Coerce into a String, unless the argument is nil.
-
.Symbol(arg) ⇒ Symbol
Coerce into a Symbol, unless the argument is nil.
-
.Time(arg) ⇒ Time
Coerce into a Time, unless the argument is nil.
Class Method Details
.Array(arg) ⇒ Array
Coerce into an Array, unless the argument is nil
21 22 23 |
# File 'lib/lotus/model/mapping/coercions.rb', line 21 def self.Array(arg) ::Kernel.Array(arg) unless arg.nil? end |
.BigDecimal(arg) ⇒ BigDecimal
Coerce into a BigDecimal, unless the argument is nil
126 127 128 |
# File 'lib/lotus/model/mapping/coercions.rb', line 126 def self.BigDecimal(arg) Utils::Kernel.BigDecimal(arg) unless arg.nil? end |
.Boolean(arg) ⇒ Boolean
Coerce into a Boolean, unless the argument is nil
36 37 38 |
# File 'lib/lotus/model/mapping/coercions.rb', line 36 def self.Boolean(arg) Utils::Kernel.Boolean(arg) unless arg.nil? end |
.Date(arg) ⇒ Date
Coerce into a Date, unless the argument is nil
51 52 53 |
# File 'lib/lotus/model/mapping/coercions.rb', line 51 def self.Date(arg) Utils::Kernel.Date(arg) unless arg.nil? end |
.DateTime(arg) ⇒ DateTime
Coerce into a DateTime, unless the argument is nil
66 67 68 |
# File 'lib/lotus/model/mapping/coercions.rb', line 66 def self.DateTime(arg) Utils::Kernel.DateTime(arg) unless arg.nil? end |
.Float(arg) ⇒ Float
Coerce into a Float, unless the argument is nil
81 82 83 |
# File 'lib/lotus/model/mapping/coercions.rb', line 81 def self.Float(arg) Utils::Kernel.Float(arg) unless arg.nil? end |
.Hash(arg) ⇒ Hash
Coerce into a Hash, unless the argument is nil
96 97 98 |
# File 'lib/lotus/model/mapping/coercions.rb', line 96 def self.Hash(arg) Utils::Kernel.Hash(arg) unless arg.nil? end |
.Integer(arg) ⇒ Integer
Coerce into an Integer, unless the argument is nil
111 112 113 |
# File 'lib/lotus/model/mapping/coercions.rb', line 111 def self.Integer(arg) Utils::Kernel.Integer(arg) unless arg.nil? end |
.Set(arg) ⇒ Set
Coerce into a Set, unless the argument is nil
141 142 143 |
# File 'lib/lotus/model/mapping/coercions.rb', line 141 def self.Set(arg) Utils::Kernel.Set(arg) unless arg.nil? end |
.String(arg) ⇒ String
Coerce into a String, unless the argument is nil
156 157 158 |
# File 'lib/lotus/model/mapping/coercions.rb', line 156 def self.String(arg) Utils::Kernel.String(arg) unless arg.nil? end |
.Symbol(arg) ⇒ Symbol
Coerce into a Symbol, unless the argument is nil
171 172 173 |
# File 'lib/lotus/model/mapping/coercions.rb', line 171 def self.Symbol(arg) Utils::Kernel.Symbol(arg) unless arg.nil? end |
.Time(arg) ⇒ Time
Coerce into a Time, unless the argument is nil
186 187 188 |
# File 'lib/lotus/model/mapping/coercions.rb', line 186 def self.Time(arg) Utils::Kernel.Time(arg) unless arg.nil? end |