lib/active_support/duration.rb in activesupport-5.1.5 vs lib/active_support/duration.rb in activesupport-5.1.6
- old
+ new
@@ -381,9 +381,17 @@
def respond_to_missing?(method, include_private = false) #:nodoc:
@value.respond_to?(method, include_private)
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