-
-
Save niklas/1203179 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
class TaskManager | |
# [..] | |
# do you think this may work? (hoptoad_options scope) | |
def scheduler(key) | |
hoptoad_options = { :environment_name => @env } | |
@schedulers[key] ||= Rufus::Scheduler.start_new.tap do |scheduler| | |
def scheduler.handle_exception(job, exception) | |
HoptoadNotifier.notify(exception, hoptoad_options.merge(:parameters => { :job => job })) | |
say "job #{job.job_id} caught exception '#{exception}' - the Airbrake has been triggered" | |
end | |
end | |
end | |
end |
This file contains hidden or 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