module Kredis::TypeCasting
Constants
- TYPES
Public Instance Methods
string_to_type(value, type)
click to toggle source
# File lib/kredis/type_casting.rb, line 25 def string_to_type(value, type) raise InvalidType if type && !TYPES.key?(type) TYPES[type || :string].cast(value) end
strings_to_types(values, type)
click to toggle source
# File lib/kredis/type_casting.rb, line 35 def strings_to_types(values, type) Array(values).flatten.map { |value| string_to_type(value, type) } end
type_to_string(value, type)
click to toggle source
# File lib/kredis/type_casting.rb, line 19 def type_to_string(value, type) raise InvalidType if type && !TYPES.key?(type) TYPES[type || :string].serialize(value) end
types_to_strings(values, type)
click to toggle source
# File lib/kredis/type_casting.rb, line 31 def types_to_strings(values, type) Array(values).flatten.map { |value| type_to_string(value, type) } end