module Shrink::Wrap::Support::TypeCheck
Public Instance Methods
ensure_callable!(element, arity = nil)
click to toggle source
# File lib/shrink/wrap/support/type_check.rb, line 14 def ensure_callable!(element, arity = nil) unless element.respond_to?(:call) raise ArgumentError, "expected callable, got: #{element.inspect}" end if arity && (!element.respond_to?(:arity) || element.arity != arity) raise ArgumentError, "expected callable with arity of #{arity}" end end
ensure_type!(klass, data)
click to toggle source
rubocop:disable Style/GuardClause
# File lib/shrink/wrap/support/type_check.rb, line 8 def ensure_type!(klass, data) unless data.is_a?(klass) raise ArgumentError, "expected #{klass}, got: #{data.inspect}" end end