File Manager

Path: /proc/self/root/opt/chef/embedded/lib/ruby/gems/2.7.0/gems/tins-1.25.0/lib/tins/

Viewing File: ask_and_send.rb

module Tins
  module AskAndSend
    def ask_and_send(method_name, *args, &block)
      if respond_to?(method_name)
        __send__(method_name, *args, &block)
      end
    end

    def ask_and_send!(method_name, *args, &block)
      if respond_to?(method_name, true)
        __send__(method_name, *args, &block)
      end
    end

    def ask_and_send_or_self(method_name, *args, &block)
      if respond_to?(method_name)
        __send__(method_name, *args, &block)
      else
        self
      end
    end

    def ask_and_send_or_self!(method_name, *args, &block)
      if respond_to?(method_name, true)
        __send__(method_name, *args, &block)
      else
        self
      end
    end
  end
end