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

Support Psych v4.0.0 #20

Open
tmimura39 opened this issue Aug 2, 2021 · 4 comments · May be fixed by #21
Open

Support Psych v4.0.0 #20

tmimura39 opened this issue Aug 2, 2021 · 4 comments · May be fixed by #21

Comments

@tmimura39
Copy link

Ruby master ships with Psych 4.0.0 which makes YAML.load
defaults to safe mode (ruby/psych#487).

So alias is not available.

# application.yml
defaults: &defaults
  cool:
    saweet: nested settings
  neat_setting: 24
  awesome_setting: <%= "Did you know 5 + 5 = #{5 + 5}?" %>

development:
  <<: *defaults
  neat_setting: 800

test:
  <<: *defaults

production:
  <<: *defaults
# main.rb
require 'settingslogic'

class Settings < Settingslogic
  source 'application.yml'
  namespace 'development'
end

p Psych::VERSION
p Settings.neat_setting
root@a250c88f3eb5:~# ruby main.rb
"4.0.1"
/usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias': Unknown alias: defaults (Psych::BadAlias)
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each_slice'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `revive_hash'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `each_slice'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:343:in `revive_hash'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:30:in `visit'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/visitor.rb:6:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych/visitors/to_ruby.rb:35:in `accept'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych.rb:335:in `safe_load'
	from /usr/local/bundle/gems/psych-4.0.1/lib/psych.rb:370:in `load'
	from /usr/local/bundle/gems/settingslogic-2.0.9/lib/settingslogic.rb:103:in `initialize'
	from /usr/local/bundle/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `new'
	from /usr/local/bundle/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `instance'
	from /usr/local/bundle/gems/settingslogic-2.0.9/lib/settingslogic.rb:66:in `method_missing'
	from main.rb:9:in `<main>'
@tmimura39 tmimura39 linked a pull request Aug 2, 2021 that will close this issue
@lionelchauvin
Copy link

@goosetav Hello, we are using this gem in our projects and we have the same problem with ruby 3. Can this pull request be reviewed ?

@amy-hs
Copy link

amy-hs commented Feb 14, 2023

@binarylogic @goosetav Bumping! This would be really, really helpful to update.

@ccurtisj
Copy link

Same ❤️

@odarriba
Copy link

is there any fork that is maintained and with this issue fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants