Class: Checkers::Checklist

Inherits:
Object
  • Object
show all
Defined in:
lib/checkers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, caller, printer = Checkers.printer, run = Checkers.run, &block) ⇒ Checklist

Returns a new instance of Checklist.



63
64
65
66
67
68
69
# File 'lib/checkers.rb', line 63

def initialize(name, caller, printer = Checkers.printer, run = Checkers.run, &block)
  @name = name
  @caller = caller
  @block = block
  @printer = printer
  @run = run
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



61
62
63
# File 'lib/checkers.rb', line 61

def block
  @block
end

#callerObject (readonly)

Returns the value of attribute caller.



61
62
63
# File 'lib/checkers.rb', line 61

def caller
  @caller
end

#errorObject (readonly)

Returns the value of attribute error.



61
62
63
# File 'lib/checkers.rb', line 61

def error
  @error
end

#nameObject (readonly)

Returns the value of attribute name.



61
62
63
# File 'lib/checkers.rb', line 61

def name
  @name
end

#printerObject (readonly)

Returns the value of attribute printer.



61
62
63
# File 'lib/checkers.rb', line 61

def printer
  @printer
end

#runObject (readonly)

Returns the value of attribute run.



61
62
63
# File 'lib/checkers.rb', line 61

def run
  @run
end

Instance Method Details

#check(subject) ⇒ Object



79
80
81
# File 'lib/checkers.rb', line 79

def check(subject)
  Check.new(subject, caller)
end

#verifyObject



71
72
73
74
75
76
77
# File 'lib/checkers.rb', line 71

def verify
  printer.checklist self
  instance_eval(&block)
rescue StandardError => e
  @error = e
  run.fail(self)
end