Skip to content

Commit

Permalink
Fix serialization of class methods
Browse files Browse the repository at this point in the history
According to collectiveidea#306, class methods were not having their payload object
set to the correct value.

Instead of being the classname of the target class, the payload object
was getting set to Class.
  • Loading branch information
bryckbost committed Jan 13, 2012
1 parent 0b03c00 commit 0234444
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/delayed/syck_ext.rb
Expand Up @@ -2,7 +2,7 @@ class Module
yaml_as "tag:ruby.yaml.org,2002:module"

def self.yaml_new(klass, tag, val)
klass
val.constantize
end

def to_yaml(options = {})
Expand Down
4 changes: 2 additions & 2 deletions spec/yaml_ext_spec.rb
Expand Up @@ -3,14 +3,14 @@
describe "YAML" do
it "should autoload classes" do
lambda {
yaml = "--- !ruby/class:Autoloaded::Clazz {}\n"
yaml = "--- !ruby/class Autoloaded::Clazz\n"
YAML.load(yaml).should == Autoloaded::Clazz
}.should_not raise_error
end

it "should autoload the class of a struct" do
lambda {
yaml = "--- !ruby/class:Autoloaded::Struct {}\n"
yaml = "--- !ruby/class Autoloaded::Struct\n"
YAML.load(yaml).should == Autoloaded::Struct
}.should_not raise_error
end
Expand Down

0 comments on commit 0234444

Please sign in to comment.