Module: Bubot
- Defined in:
- lib/bubot.rb,
lib/bubot/version.rb
Constant Summary collapse
- VERSION =
"0.0.4"
Instance Method Summary collapse
Instance Method Details
#watch(method_name, timeout = 0) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bubot.rb', line 5 def watch(method_name, timeout=0) define_method("#{method_name}_with_feature") do start_time = Time.now method_return_value = send("#{method_name}_without_feature".to_sym) if (total_time = Time.now - start_time) > timeout yield(self, total_time, method_return_value) end method_return_value end alias_method_chain_or_register(method_name) end |