lib/transcriber/resource/serialization/boolean.rb in transcriber-0.0.25 vs lib/transcriber/resource/serialization/boolean.rb in transcriber-0.0.26

- old
+ new

@@ -29,9 +29,22 @@ def self.serialize(value) MAPPINGS[value].tap do |bool| fail "value not serializable: #{value}" if bool.nil? end end + + def self.desserialize(value) + fail unless boolean?(value) + + value ? Transcriber.configuration.true_value + : Transcriber.configuration.false_value + end + + private + + def self.boolean?(value) + !!value == value + end end end end end