lib/timespan/mongoid.rb in timespan-0.4.6 vs lib/timespan/mongoid.rb in timespan-0.4.9

- old
+ new

@@ -37,9 +37,15 @@ to_value = hash['to'] || hash[:to] raise ArgumentError, ":to is nil, #{hash.inspect}" if to_value.nil? deserialize_time to_value end + def asap hash + asap_value = hash['asap'] || hash[:asap] + raise ArgumentError, ":asap is nil, #{hash.inspect}" if ![true, false, nil].include? asap_value + asap_value + end + def serialize_time time raise ArgumentError, "Can't serialize time from nil" if time.nil? time.to_i end \ No newline at end of file