Skip to content

Instantly share code, notes, and snippets.

@cgriego
Created November 30, 2011 02:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgriego/1407770 to your computer and use it in GitHub Desktop.
Save cgriego/1407770 to your computer and use it in GitHub Desktop.
EvilObject
class EvilObject
class << self
def const_defined?(*)
true
end
def const_get(*)
Object
end
def include?(*)
true
end
def method_defined?(*)
true
end
def name
"Object"
end
def superclass
nil
end
def ancestors
[]
end
end
def class
Object
end
def nil?
true
end
def <=>(other)
0
end
def clone
self
end
alias_method :dup, :clone
def hash
1
end
alias_method :object_id, :hash
def send(*)
end
def is_a?(*)
true
end
alias_method :kind_of?, :is_a?
def tap
end
def respond_to?(*)
true
end
def method(*)
super(:object_id)
end
def method_missing(*)
end
def to_s
1
end
def to_i
"i"
end
def to_enum
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment