Skip to content

Unable to load DateTime.new #168

@tobiasr

Description

@tobiasr

I'm unable to get this to work:

Psych.load(Psych.dump(DateTime.new))

I get the following stack trace on 2.0.0.

ArgumentError: argument out of range
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/scalar_scanner.rb:127:in `utc'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/scalar_scanner.rb:127:in `parse_time'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:65:in `deserialize'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:104:in `visit_Psych_Nodes_Scalar'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:240:in `visit_Psych_Nodes_Document'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych/nodes/node.rb:35:in `to_ruby'
    from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:130:in `load'
    from (irb):1
    from /.rvm/gems/ruby-2.0.0-p247@project/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
    from /.rvm/gems/ruby-2.0.0-p247@project/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
    from /.rvm/gems/ruby-2.0.0-p247@project/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

It should work right? Or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions