Skip to content

Commit

Permalink
Use yaml_tag instead of deprecated yaml_as
Browse files Browse the repository at this point in the history
`yaml_as` is deprecated since Ruby 1.9.3.
ruby/ruby@5b5bbdb

And it will be remove in Ruby 2.5.0.
ruby/ruby@6d77e28
  • Loading branch information
y-yagi committed Sep 4, 2017
1 parent 7db5654 commit 2e2c3fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/delayed/serialization/active_record.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if defined?(ActiveRecord)
module ActiveRecord
class Base
yaml_as 'tag:ruby.yaml.org,2002:ActiveRecord'
yaml_tag 'tag:ruby.yaml.org,2002:ActiveRecord'

def self.yaml_new(klass, _tag, val)
klass.unscoped.find(val['attributes'][klass.primary_key])
Expand Down
4 changes: 2 additions & 2 deletions lib/delayed/syck_ext.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Module
yaml_as 'tag:ruby.yaml.org,2002:module'
yaml_tag 'tag:ruby.yaml.org,2002:module'

def self.yaml_new(_klass, _tag, val)
val.constantize
Expand All @@ -20,7 +20,7 @@ def yaml_tag_read_class(name)
end

class Class
yaml_as 'tag:ruby.yaml.org,2002:class'
yaml_tag 'tag:ruby.yaml.org,2002:class'
remove_method :to_yaml if respond_to?(:to_yaml) && method(:to_yaml).owner == Class # use Module's to_yaml
end

Expand Down

0 comments on commit 2e2c3fb

Please sign in to comment.