lib/remarkable/base.rb in remarkable-3.0.0 vs lib/remarkable/base.rb in remarkable-3.0.1
- old
+ new
@@ -1,18 +1,19 @@
module Remarkable
class Base
include Remarkable::Messages
extend Remarkable::DSL
-
+
+ # Optional to provide spec binding to matchers.
def spec(binding)
@spec = binding
self
end
- private
+ protected
- # Returns the subject class if it's not one.
+ # Returns the subject class unless it's a class object.
def subject_class
nil unless @subject
@subject.is_a?(Class) ? @subject : @subject.class
end
@@ -23,11 +24,11 @@
subject_class.respond_to?(:human_name) ? subject_class.human_name : subject_class.name
end
# Iterates over the collection given yielding the block and return false
# if any of them also returns false.
- def assert_matcher_for(collection)
+ def assert_matcher_for(collection) #:nodoc:
collection.each do |item|
return false unless yield(item)
end
true
end
@@ -37,10 +38,10 @@
#
# assert_contains(['a', '1'], /\d/) => passes
# assert_contains(['a', '1'], 'a') => passes
# assert_contains(['a', '1'], /not there/) => fails
#
- def assert_contains(collection, x) # :nodoc:
+ def assert_contains(collection, x)
collection = [collection] unless collection.is_a?(Array)
case x
when Regexp
collection.detect { |e| e =~ x }