Skip to content

Instantly share code, notes, and snippets.

@jfontan
Created April 16, 2010 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfontan/368712 to your computer and use it in GitHub Desktop.
Save jfontan/368712 to your computer and use it in GitHub Desktop.
# Fix for ruby 1.8.5
def Object.class_variable_defined?(var)
Object.class_variables.include?(var.to_s)
end unless Object.respond_to? :class_variable_defined?
class Object
def instance_variable_defined?(var)
self.instance_variables.include?(var.to_s)
end unless Object.new.respond_to? :instance_variable_defined?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment