class Portunus::TypeCaster
Constants
- TYPE_MAP
Attributes
type[R]
value[R]
Public Class Methods
cast(value:, type: nil)
click to toggle source
# File lib/portunus/type_caster.rb, line 12 def self.cast(value:, type: nil) new(value: value, type: type).cast end
new(value:, type: :string)
click to toggle source
# File lib/portunus/type_caster.rb, line 20 def initialize(value:, type: :string) @value = value @type = type end
uncast(value:, type: nil)
click to toggle source
# File lib/portunus/type_caster.rb, line 16 def self.uncast(value:, type: nil) new(value: value, type: type).uncast end
Public Instance Methods
cast()
click to toggle source
# File lib/portunus/type_caster.rb, line 25 def cast TYPE_MAP[type.to_sym].cast(value: value) end
uncast()
click to toggle source
# File lib/portunus/type_caster.rb, line 29 def uncast TYPE_MAP[type.to_sym].uncast(value: value) end