Comments (3)
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.
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.
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)
- Yes, no and YAML version 1.2 support
- Linter friendly YAML output HOT 3
- Confusing error: Unknown alias: foo (Psych::BadAlias) HOT 2
- `nil` value in Hash generates trailing whitespace HOT 6
- `key: :99` reports value as `:"99"` rather than `":99"` - how to include second colon as part of the value string?
- yaml.h not found and psych.rb:455:in `parse_stream`: undefined method `parse` for #<Psych::Parser HOT 9
- 5.0 release breaks JRuby gem HOT 9
- macOS - will psych.bundle load? HOT 1
- Can't install psych 5.0.1 in macOS on Apple Silicon HOT 19
- Fail to install psych 5.0.1 on Ubuntu with any Ruby version HOT 2
- psych fails to install on windows HOT 1
- Psych::DisallowedClass (Tried to load unspecified class: Time): HOT 1
- Cannot install on an M1 Mac using `--with-libyaml-source-dir`
- Tried to load unspecified class: IPAddr
- dump is not escaping non-printable characters
- Feature: configure block scalar type
- Error loading Psych gem specification on Ruby 3.2.2 HOT 1
- YAML string in exponential format cannot be loaded by YAML 1.2 parser
- Psych::BadAlias error with simple alias HOT 1
- Version 4.0.5 breaks Date deserialization HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psych.