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

Cannot use this with ruby 1.8.7 (2009-06-12 patchlevel 174) on Rails 2.3.8 #18

Open
phuong-nguyen opened this issue Jul 29, 2011 · 1 comment

Comments

@phuong-nguyen
Copy link

I cannot use settings logic because the osx import invoke name method upon class initialization, which in turn trigger Settingslogic instantiation before the "source yml_file" being executed, lead to error.
Here is the trace I produced with debugger

[-2, 6] in /Users/eastagile/code/Swink/app/settings/encoding_settings.rb
1 require 'ruby-debug'
2 debugger
=> 3 class EncodingSettings < Settingslogic
4 source "#{Rails.root}/config/encoding_settings.yml"
5 namespace Rails.env
6 end
/Users/eastagile/code/Swink/app/settings/encoding_settings.rb:3
class EncodingSettings < Settingslogic
(rdb:1) s

[713, 722] in /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb
713 end
714 end
715
716 alias _before_osx_inherited inherited
717 def inherited(subklass)
=> 718 nsklassname, mod = _real_class_and_mod(subklass)
719 if nsklassname and (first_char = nsklassname[0]) >= ?A and first_char <= ?Z
720 # remove Ruby's class
721 mod.instance_eval { remove_const nsklassname.intern }
722 begin
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb:718
nsklassname, mod = _real_class_and_mod(subklass)
(rdb:1)

[699, 708] in /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb
699 # a Cocoa class from # OSX.ns_import.
700 #
701 class Object
702 class <<self
703 def _real_class_and_mod(klass)
=> 704 unless klass.ancestors.include?(OSX::Boxed)
705 klassname = klass.name.to_s
706 unless klassname.nil? || klassname.empty?
707 if Object.included_modules.include?(OSX) and /::/.match(klassname).nil?
708 [klassname, Object]
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb:704
unless klass.ancestors.include?(OSX::Boxed)
(rdb:1)

[699, 708] in /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb
699 # a Cocoa class from # OSX.ns_import.
700 #
701 class Object
702 class <<self
703 def _real_class_and_mod(klass)
=> 704 unless klass.ancestors.include?(OSX::Boxed)
705 klassname = klass.name.to_s
706 unless klassname.nil? || klassname.empty?
707 if Object.included_modules.include?(OSX) and /::/.match(klassname).nil?
708 [klassname, Object]
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb:704
unless klass.ancestors.include?(OSX::Boxed)
(rdb:1)

[700, 709] in /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb
700 #
701 class Object
702 class <<self
703 def _real_class_and_mod(klass)
704 unless klass.ancestors.include?(OSX::Boxed)
=> 705 klassname = klass.name.to_s
706 unless klassname.nil? || klassname.empty?
707 if Object.included_modules.include?(OSX) and /::/.match(klassname).nil?
708 [klassname, Object]
709 elsif klassname[0..4] == 'OSX::' and (tokens = klassname.split(/::/)).size == 2 and klass.superclass != OSX::Boxed
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_import.rb:705
klassname = klass.name.to_s
(rdb:1)

[5, 14] in /Users/eastagile/code/Swink/.bundle/ruby/1.8/gems/settingslogic-2.0.6/lib/settingslogic.rb
5 class Settingslogic < Hash
6 class MissingSetting < StandardError; end
7
8 class << self
9 def name # :nodoc:
=> 10 instance.key?("name") ? instance.name : super
11 end
12
13 # Enables Settings.get('nested.key.name') for dynamic access
14 def get(key)
/Users/eastagile/code/Swink/.bundle/ruby/1.8/gems/settingslogic-2.0.6/lib/settingslogic.rb:10

@transcendent
Copy link

Seeing the same issue on Ruby 1.9.2 with 3.0.7 on OS X

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

No branches or pull requests

2 participants