Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable YAML serialization of Ruby delegators #158

Closed
wants to merge 1 commit into from
Closed

Enable YAML serialization of Ruby delegators #158

wants to merge 1 commit into from

Conversation

laserlemon
Copy link

This works for SimpleDelegator as well.

@laserlemon
Copy link
Author

This doesn't include a test because I couldn't quite figure out the test suite, but I want to start the conversation.

@laserlemon
Copy link
Author

This relates to #100.

@laserlemon
Copy link
Author

Figured out the tests. I'll start on this later. My brain (and my finger) hurts.

@laserlemon
Copy link
Author

Tests added and 🚦 💚

Is this fitting?

@lazywei
Copy link

lazywei commented Oct 14, 2013

this works for me, THX.

@tenderlove
Copy link
Member

Hi, can you rebase this and run the tests against Ruby 2.1? It seems to fail for me:

  1) Error:
Psych::Visitors::TestYAMLTree#test_simple_delegator:
ArgumentError: not delegated
    /Users/aaron/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/delegate.rb:309:in `__getobj__'
    /Users/aaron/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/delegate.rb:96:in `respond_to_missing?'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:343:in `respond_to?'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:343:in `init_with'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:336:in `revive'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:201:in `visit_Psych_Nodes_Mapping'
    /Users/aaron/git/psych/lib/psych/visitors/visitor.rb:15:in `visit'
    /Users/aaron/git/psych/lib/psych/visitors/visitor.rb:5:in `accept'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:31:in `accept'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:274:in `visit_Psych_Nodes_Document'
    /Users/aaron/git/psych/lib/psych/visitors/visitor.rb:15:in `visit'
    /Users/aaron/git/psych/lib/psych/visitors/visitor.rb:5:in `accept'
    /Users/aaron/git/psych/lib/psych/visitors/to_ruby.rb:31:in `accept'
    /Users/aaron/git/psych/lib/psych/nodes/node.rb:37:in `to_ruby'
    /Users/aaron/git/psych/lib/psych.rb:245:in `load'
    /Users/aaron/git/psych/test/psych/helper.rb:65:in `assert_cycle'
    /Users/aaron/git/psych/test/psych/visitors/test_yaml_tree.rb:186:in `test_simple_delegator'

@laserlemon
Copy link
Author

I'm seeing the same thing. It seems that in Ruby 2.1.0, you can't allocate a SimpleDelegator.

@laserlemon
Copy link
Author

I'm afraid I'm in over my head now. 😞

@hsbt
Copy link
Member

hsbt commented Jun 16, 2017

This pull request merged at c2e3a03

@hsbt hsbt closed this Jun 16, 2017
matzbot pushed a commit to ruby/ruby that referenced this pull request Jun 16, 2017
  It contains following changes from 3.0.0.beta1

    * Preserve time zone offset when deserializing times
      ruby/psych#316

    * Enable YAML serialization of Ruby delegators
      ruby/psych#158

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants