Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ruby 1.8 alternative to define_singleton_method #31

Merged
merged 2 commits into from

2 participants

Darragh Curran Jeff Gardner
Darragh Curran
Owner

fixes #30

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

Jeff Gardner

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 Curran darragh merged commit bd8b9d4 into from
Phill Baker 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
10 lib/intercom-rails/config.rb
View
@@ -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
2  lib/intercom-rails/version.rb
View
@@ -1,3 +1,3 @@
module IntercomRails
- VERSION = "0.2.14"
+ VERSION = "0.2.15"
end
Something went wrong with that request. Please try again.