class Expects::Handler

Attributes

objects[R]
subject[R]

Public Class Methods

new(subject, objects) click to toggle source
# File lib/expects/handler.rb, line 5
def initialize(subject, objects)
  @subject = subject
  @objects = objects
end

Public Instance Methods

accept!() click to toggle source
# File lib/expects/handler.rb, line 14
def accept!
  raise UnexpectedInput.new(self) unless valid?
end
build_message() click to toggle source
# File lib/expects/handler.rb, line 22
def build_message
  "Expected #{@subject.inspect} to be #{@objects.join(", ")}"
end
reject!() click to toggle source
# File lib/expects/handler.rb, line 18
def reject!
  raise UnexpectedInput.new(self) if valid?
end
valid?() click to toggle source
# File lib/expects/handler.rb, line 10
def valid?
  @objects.include? @subject.class
end