4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/arsettings/has_settings.rb', line 4
def has_setting( name , inner_options={} , &block )
@arsettings_package ||= ARSettings.default_class.package(self)
instance = inner_options.delete :instance
package = @arsettings_package
package.add name , inner_options , &block
definitions = lambda do |*args|
define_method name do package.send name end define_method "#{name}=" do |arg| package.send "#{name}=" , arg end define_method "#{name}?" do package.send "#{name}?" end end
(class << self ; self ; end).instance_eval(&definitions)
definitions.call if instance
end
|