Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ruby 1.8 alternative to define_singleton_method #31

Merged
merged 2 commits into from

2 participants

@darragh
Owner

fixes #30

rush job (I didn't check for other ruby 1.8 compatibility issues yet) - but this might do it.

@erskingardner

Just downloaded 1.8.7-p371 and it worked with this branch of the gem on a fresh rails install.

I'd say :ship: :it: :shipit:

@darragh darragh merged commit bd8b9d4 into master

1 check was pending

Details default
@phillbaker phillbaker referenced this pull request in clbustos/integration
Open

1.8.7 Compatibility #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 4 deletions.
  1. +7 −3 lib/intercom-rails/config.rb
  2. +1 −1  lib/intercom-rails/version.rb
View
10 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
View
2  lib/intercom-rails/version.rb
@@ -1,3 +1,3 @@
module IntercomRails
- VERSION = "0.2.14"
+ VERSION = "0.2.15"
end
Something went wrong with that request. Please try again.