Class: Checkers::Checklist
- Inherits:
-
Object
- Object
- Checkers::Checklist
- Defined in:
- lib/checkers.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#caller ⇒ Object
readonly
Returns the value of attribute caller.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#printer ⇒ Object
readonly
Returns the value of attribute printer.
-
#run ⇒ Object
readonly
Returns the value of attribute run.
Instance Method Summary collapse
- #check(subject) ⇒ Object
-
#initialize(name, caller, printer = Checkers.printer, run = Checkers.run, &block) ⇒ Checklist
constructor
A new instance of Checklist.
- #verify ⇒ Object
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
#block ⇒ Object (readonly)
Returns the value of attribute block.
61 62 63 |
# File 'lib/checkers.rb', line 61 def block @block end |
#caller ⇒ Object (readonly)
Returns the value of attribute caller.
61 62 63 |
# File 'lib/checkers.rb', line 61 def caller @caller end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
61 62 63 |
# File 'lib/checkers.rb', line 61 def error @error end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
61 62 63 |
# File 'lib/checkers.rb', line 61 def name @name end |
#printer ⇒ Object (readonly)
Returns the value of attribute printer.
61 62 63 |
# File 'lib/checkers.rb', line 61 def printer @printer end |
#run ⇒ Object (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 |
#verify ⇒ Object
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 |