Method: Command::CommandBase#hook_call
- Defined in:
- lib/commandbase.rb
#hook_call(target_method, *argv) ⇒ Object
指定したメソッドを呼び出す際に、フック関数があればそれ経由で呼ぶ
指定したメソッドは存在しなくてもいい。存在しなければ空のProcが作られる
102 103 104 105 106 107 108 109 110 |
# File 'lib/commandbase.rb', line 102 def hook_call(target_method, *argv) hook = "hook_#{target_method}" target_method_proc = self.method(target_method) rescue ->{} if respond_to?(hook) self.__send__(hook, *argv, &target_method_proc) else target_method_proc.call(*argv) end end |