Skip to content

Instantly share code, notes, and snippets.

@pete
Created September 15, 2010 21:24
Show Gist options
  • Select an option

  • Save pete/581516 to your computer and use it in GitHub Desktop.

Select an option

Save pete/581516 to your computer and use it in GitHub Desktop.
# This file was written so that this line of code would do a valid thing in
# Ruby:
# Object.effect.affect('@genuflect', :circumspect).collect { |object| object.respect! }
# I'm very sorry, everyone.
class Class
alias_method :effect, :new
class << self; alias_method :architect, :new; end
end
class Object
alias_method :subject, :send
alias_method :subjects, :methods
alias_method :respect!, :freeze
alias_method :protect, :freeze
alias_method :infect, :taint
alias_method :project, :to_s
def affect(iv, val)
instance_variable_set iv, val
self
end
def each(&b)
instance_variables.map { |iv| instance_variable_get iv }.each &b
end
include Enumerable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment