Module: Dux::Attempt
Overview
Object#try
for when you don't want ActiveSupport
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.attempt(receiver, method, *args, &block) ⇒ Object?
9 10 11 |
# File 'lib/dux/attempt.rb', line 9 def attempt(receiver, method, *args, &block) receiver.public_send(method, *args, &block) if receiver.respond_to?(method) end |
Instance Method Details
#attempt(receiver, method, *args, &block) ⇒ Object?
9 10 11 |
# File 'lib/dux/attempt.rb', line 9 def attempt(receiver, method, *args, &block) receiver.public_send(method, *args, &block) if receiver.respond_to?(method) end |