Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chetan/psych_load_bug
https://github.com/chetan/psych_load_bug
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/chetan/psych_load_bug
- Owner: chetan
- Created: 2015-01-22T20:59:14.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-22T21:49:43.000Z (almost 10 years ago)
- Last Synced: 2024-10-19T03:45:04.669Z (2 months ago)
- Language: Ruby
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## psych gem conflict with json on ruby 2.2.0
The `psych` (~> 2.0.11) gem appears to conflict with `json` (~> 1.8.2) gem when loaded via a gemspec dependency and either `yaml` or `psych` are required before `json`.
The problem only occurs on `ruby 2.2.0p0` but appears to be fixed on 2.2-head `ruby 2.2.0p36 (2015-01-22 revision 49375)`.
### The problem
```bash
$ psych_load_bug
testing yaml:
/Users/chetan/.rvm/gems/ruby-2.2.0/gems/psych_load_bug-0.1.0/bin/psych_load_bug:13:in `': private method `load' called for Psych:Module (NoMethodError)
from /Users/chetan/.rvm/gems/ruby-2.2.0/bin/psych_load_bug:23:in `load'
from /Users/chetan/.rvm/gems/ruby-2.2.0/bin/psych_load_bug:23:in `'
```Runs correctly:
```bash
$ ruby -rjson `which psych_load_bug`
testing yaml:
{"a"=>"b"}$ ruby -ryaml `which psych_load_bug`
testing yaml:
{"a"=>"b"}$ gem uninstall psych_load_bug
$ bundle exec ruby -Ilib/ bin/psych_load_bug
testing yaml:
{"a"=>"b"}
```The same result can also be achieved by uncommenting the json line in `lib/psych_load_bug.rb`.
### Reproducing
```bash
$ git clone https://github.com/chetan/psych_load_bug.git
$ cd psych_load_bug
$ bundle install
$ rake clean install
$ psych_load_bug
```### Solution
Make sure the `json` gem is loaded first! (maybe?)
Other than that, I am not sure why the two are conflicing. The library load path doesn't seem to be altered by the inclusion of the json gem. Perhaps it's a Rubygems bug?