diff --git a/lib/intercom-rails/config.rb b/lib/intercom-rails/config.rb index 5c058a4..818afb0 100644 --- a/lib/intercom-rails/config.rb +++ b/lib/intercom-rails/config.rb @@ -9,14 +9,18 @@ def self.config_accessor(*args, &block) config_writer(*args, &block) end + def self.meta_class + class << self; self end + end + def self.config_reader(name) - self.send(:define_singleton_method, name) do + meta_class.send(:define_method, name) do instance_variable_get("@#{name}") end end def self.config_writer(name, &block) - self.send(:define_singleton_method, "#{name}=") do |value| + meta_class.send(:define_method, "#{name}=") do |value| block.call(value) if block && (block.arity <= 1) if block && (block.arity > 1) @@ -32,7 +36,7 @@ def self.config_group(name, &block) camelized_name = name.to_s.classify group = self.const_set(camelized_name, Class.new(self)) - self.send(:define_singleton_method, name) do + meta_class.send(:define_method, name) do group end diff --git a/lib/intercom-rails/version.rb b/lib/intercom-rails/version.rb index ecd31a5..a010a80 100644 --- a/lib/intercom-rails/version.rb +++ b/lib/intercom-rails/version.rb @@ -1,3 +1,3 @@ module IntercomRails - VERSION = "0.2.14" + VERSION = "0.2.15" end