lib/qo/public_api.rb in qo-0.2.0 vs lib/qo/public_api.rb in qo-0.2.1
- old
+ new
@@ -3,11 +3,12 @@
# top level Qo namespace, and should not change. It should be used as the
# subject of Acceptance level tests for the library and should not have its
# externally facing methods renamed or moved under pain of a look of profound
# disappointment from the creator.
#
- # @author [baweaver]
+ # @author baweaver
+ # @since 0.2.0
#
module PublicApi
include Qo::Exceptions
# Creates an `and` type query matcher. All conditions in this type of matcher
@@ -18,11 +19,11 @@
# @param **keyword_matchers [Hash] Keyword style conditionals
#
# @return [Proc[Any]]
# Any -> Bool # Given a target, will return if it "matches"
def and(*array_matchers, **keyword_matchers)
- create_matcher('and', *array_matchers, **keyword_matchers)
+ create_matcher('and', array_matchers, keyword_matchers)
end
# The magic that lets you use `Qo[...]` instead of `Qo.and(...)`. Use wisely
alias_method :[], :and
@@ -34,11 +35,11 @@
# @param **keyword_matchers [Hash] Keyword style conditionals
#
# @return [Proc[Any]]
# Any -> Bool # Given a target, will return if it "matches"
def or(*array_matchers, **keyword_matchers)
- create_matcher('or', *array_matchers, **keyword_matchers)
+ create_matcher('or', array_matchers, keyword_matchers)
end
# Creates a `not` type query matcher. No conditions in this type of matcher
# should pass to be considered a "match". It will short-circuit in the case of
# a true match.
@@ -47,11 +48,11 @@
# @param **keyword_matchers [Hash] Keyword style conditionals
#
# @return [Proc[Any]]
# Any -> Bool # Given a target, will return if it "matches"
def not(*array_matchers, **keyword_matchers)
- create_matcher('not', *array_matchers, **keyword_matchers)
+ create_matcher('not', array_matchers, keyword_matchers)
end
# Creates a Guard Block matcher.
#
# A guard block matcher is used to guard a function from running unless
@@ -103,10 +104,10 @@
#
# @raises Qo::Exceptions::NoMatchersProvided
# @raises Qo::Exceptions::MultipleMatchersProvided
#
# @return [Qo::Matcher]
- private def create_matcher(type, *array_matchers, **keyword_matchers)
+ private def create_matcher(type, array_matchers, keyword_matchers)
array_empty, hash_empty = array_matchers.empty?, keyword_matchers.empty?
raise Qo::NoMatchersProvided if array_empty && hash_empty
raise Qo::MultipleMatchersProvided if !(array_empty || hash_empty)