class Inspector::Constraints::Predicate
Public Class Methods
new(method, *args, &block)
click to toggle source
# File lib/inspector/constraints/predicate.rb, line 6 def initialize(method, *args, &block) @method = method @args = args @block = block end
Public Instance Methods
inspect()
click to toggle source
# File lib/inspector/constraints/predicate.rb, line 33 def inspect "#<#{@method}>" end
to_s()
click to toggle source
# File lib/inspector/constraints/predicate.rb, line 29 def to_s "be_#{@method}" end
valid?(actual)
click to toggle source
# File lib/inspector/constraints/predicate.rb, line 12 def valid?(actual) result = false begin result = actual.__send__("#{@method}?", *@args, &@block) rescue NameError end begin result = actual.__send__("#{@method}s?", *@args, &@block) @method = "#{@method}s" rescue NameError end return result end