lib/active_support/duration.rb in activesupport-5.2.0.rc1 vs lib/active_support/duration.rb in activesupport-5.2.0.rc2
- old
+ new
@@ -381,9 +381,17 @@
def as_json(options = nil) #:nodoc:
to_i
end
+ def init_with(coder) #:nodoc:
+ initialize(coder["value"], coder["parts"])
+ end
+
+ def encode_with(coder) #:nodoc:
+ coder.map = { "value" => @value, "parts" => @parts }
+ end
+
# Build ISO 8601 Duration string for this duration.
# The +precision+ parameter can be used to limit seconds' precision of duration.
def iso8601(precision: nil)
ISO8601Serializer.new(self, precision: precision).serialize
end