lib/symmetric_encryption/coerce.rb in symmetric-encryption-4.3.1 vs lib/symmetric_encryption/coerce.rb in symmetric-encryption-4.3.2
- old
+ new
@@ -12,11 +12,11 @@
}.freeze
# Coerce given value into given type
# Does not coerce json or yaml values
def self.coerce(value, type, from_type = nil)
- return value if value.nil? || (value == '')
+ return value if value.nil? || (value == "")
from_type ||= value.class
case type
when :json
value
@@ -30,11 +30,11 @@
# Uses coercible gem to coerce values from strings into the target type
# Note: if the type is :string, then the value is returned as is, and the
# coercible gem is not used at all.
def self.coerce_from_string(value, type)
- return value if value.nil? || (value == '')
+ return value if value.nil? || (value == "")
case type
when :string
value
when :json
@@ -48,10 +48,10 @@
# Uses coercible gem to coerce values to strings from the specified type
# Note: if the type is :string, and value is not nil, then #to_s is called
# on the value and the coercible gem is not used at all.
def self.coerce_to_string(value, type)
- return value if value.nil? || (value == '')
+ return value if value.nil? || (value == "")
case type
when :string
value.to_s
when :json