summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-01-15 17:40:09 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-01-15 17:40:09 -0800
commit8ebbfa2df1c49e35b10f50de13af8886647bb185 (patch)
treec104524a9b8ecc0b27bad883690f59e42c3ff929 /lib
parent26fe5a33e9e4301c8a812205468b0f0ff026a164 (diff)
downloadpsych-8ebbfa2df1c49e35b10f50de13af8886647bb185.zip
switching inject to use rb_path_to_class
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/visitors/to_ruby.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index 3b53edb..f9fd2f9 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -189,10 +189,8 @@ module Psych
retried = false
begin
- name.split('::').inject(Object) { |k,sub|
- k.const_get sub
- }
- rescue NameError => ex
+ path2class(name)
+ rescue ArgumentError => ex
name = "Struct::#{name}"
unless retried
retried = true