Methods

Files

Tins::Responding

Public Instance Methods

responding?(*method_names) click to toggle source
# File lib/tins/responding.rb, line 3
def responding?(*method_names)
  Class.new do
    define_method(:to_s) do
      "Responding to #{method_names * ', '}"
    end

    alias inspect to_s

    define_method(:===) do |object|
      method_names.all? do |method_name|
        object.respond_to?(method_name)
      end
    end
  end.new
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.