Giter Site home page Giter Site logo

Comments (3)

tenderlove avatar tenderlove commented on July 28, 2024

Does this happen with the Psych gem? When I use psych to dump that hash, the values are quoted:

irb(main):002:0> require 'yaml'
=> true
irb(main):003:0> YAML.load '--- 11:22:33'
=> 40953
irb(main):004:0> YAML::ENGINE.yamler
=> "psych"
irb(main):005:0> YAML.dump '11:22:33'
=> "--- '11:22:33'\n"
irb(main):006:0> YAML.dump 'a' => '11:22:33'
=> "---\na: '11:22:33'\n"
irb(main):007:0> YAML.load YAML.dump '11:22:33'
=> "11:22:33"
irb(main):008:0>

from psych.

rsutphin avatar rsutphin commented on July 28, 2024

Hmmm. I think that /(\d\d:)+\d\d/ may have been an over-broad assumption on my part.

ruby-1.9.2-p290 :001 > require 'psych'
 => true 
ruby-1.9.2-p290 :002 > Psych.dump('11:22:33')
 => "--- '11:22:33'\n" 
ruby-1.9.2-p290 :003 > Psych.dump('01:03:05')
 => "--- 01:03:05\n...\n" 
ruby-1.9.2-p290 :004 > Psych.dump('a' => '01:03:05')
 => "---\na: 01:03:05\n"

11:22:33 is quoted, but 01:03:05 is not.

Does this happen with the Psych gem?

Apologies, I'm not sure how to test this. I installed the Psych gem but, according to $LOADED_FEATURES, the version being used is still the one under lib/ruby.

from psych.

rsutphin avatar rsutphin commented on July 28, 2024

Apologies, I'm not sure how to test this.

Figured it out two seconds later.

ruby-1.9.2-p290 :001 > $LOADED_FEATURES.grep /psych/
 => [] 
ruby-1.9.2-p290 :002 > gem 'psych'
 => true 
ruby-1.9.2-p290 :003 > require 'psych'
 => true 
ruby-1.9.2-p290 :004 > $LOADED_FEATURES.grep /psych/
# indicates that the gem version is being used
ruby-1.9.2-p290 :005 > Psych.dump('a' => '01:03:05')
 => "---\na: 01:03:05\n" 

So, version 1.2.0 of the gem has the same issue.

from psych.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.