Skip to content

Commit da38ddf

Browse files
committed
Update deprecated to_yaml to use encode_with
The poorly-documented YAML coder allows us to tell YAML to use our Hash representation when encoding. This avoids warnings that `to_yaml` was redefined from the default Object implementation.
1 parent 4695bf3 commit da38ddf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ice_cube/schedule.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ def self.from_ical(ical, options = {})
340340
IcalParser.schedule_from_ical(ical, options)
341341
end
342342

343-
# Convert the schedule to yaml
344-
def to_yaml(*args)
345-
YAML::dump(to_hash, *args)
343+
# Hook for YAML.dump, enables to_yaml
344+
def encode_with(coder)
345+
coder.represent_object nil, to_hash
346346
end
347347

348348
# Load the schedule from yaml

0 commit comments

Comments
 (0)