settingslogic
settingslogic copied to clipboard
Cannot use this with ruby 1.8.7 (2009-06-12 patchlevel 174) on Rails 2.3.8
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
Seeing the same issue on Ruby 1.9.2 with 3.0.7 on OS X