Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support ruby 1.8.7 version of const_defined

  • Loading branch information...
commit 1d3e55f069a50767cec6333a8d819a7da0968f4b 1 parent 8e3246c
@matthuhiggins authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/saxaphone/util.rb
View
12 lib/saxaphone/util.rb
@@ -7,10 +7,20 @@ def constantize(camel_cased_word)
constant = Object
names.each do |name|
- constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
+ constant = standardized_const_defined?(constant, name) ? constant.const_get(name) : constant.const_missing(name)
end
constant
end
+
+ if Module.method(:const_defined?).arity == 1
+ def standardized_const_defined?(constant, name)
+ constant.const_defined?(name)
+ end
+ else
+ def standardized_const_defined?(constant, name)
+ constant.const_defined?(name, false)
+ end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.