Created
September 8, 2011 09:41
-
-
Save kronn/1203033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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