Skip to content

Instantly share code, notes, and snippets.

@kronn
Created September 8, 2011 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kronn/1203033 to your computer and use it in GitHub Desktop.
Save kronn/1203033 to your computer and use it in GitHub Desktop.
current_scheduler = scheduler(:availabilities)
def current_scheduler.handle_exception(job, exception)
Airbrake.do_the_right_thing(exception, other_params)
puts "job #{job.job_id} caught exception '#{exception}' - the Airbrake has been triggered"
end
@cache = {}
def get(name)
@cache[name] ||= Array.new
end
# just to clarify, what get(name) does:
# it manages object references
get(:one) == get(:one)
get(:two) != get(:one)
get(:one) != []
one = get(:one)
def one.chunky
"bacon" * self.size
end
one.respond_to? :chunky
one.chunky # => ''
get(:one) << 'say it'
one.chunky # "bacon"
get(:two).respond_to? :chunky # => false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment