class Shaped::Shapes::Callable
Public Class Methods
new(callable)
click to toggle source
# File lib/shaped/shapes/callable.rb, line 4 def initialize(callable) @callable = callable end
Public Instance Methods
matched_by?(object)
click to toggle source
# File lib/shaped/shapes/callable.rb, line 8 def matched_by?(object) !!@callable.call(object) end
to_s()
click to toggle source
# File lib/shaped/shapes/callable.rb, line 12 def to_s case @callable when Method then "Method defined at #{@callable.source_location.map(&:to_s).join(':')}" when Proc then "Proc test defined at #{@callable.source_location.map(&:to_s).join(':')}" else "#call test defined at #{@callable.method(:call).source_location.map(&:to_s).join(':')}" end end