Class: CheckZilla::Model
- Inherits:
-
Object
- Object
- CheckZilla::Model
- Defined in:
- lib/checkzilla/model.rb
Instance Attribute Summary collapse
-
#checkers ⇒ Object
readonly
Returns the value of attribute checkers.
-
#notifiers ⇒ Object
readonly
Returns the value of attribute notifiers.
Instance Method Summary collapse
- #check_updates(klass, &block) ⇒ Object
-
#initialize(title = "Report", &block) ⇒ Model
constructor
A new instance of Model.
- #notify_by(klass, &block) ⇒ Object
Constructor Details
#initialize(title = "Report", &block) ⇒ Model
Returns a new instance of Model.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/checkzilla/model.rb', line 6 def initialize(title = "Report", &block) @title = title @checkers = [] @notifiers = [] instance_eval(&block) if block_given? @checkers.each do |checker| checker.perform! end @notifiers.each do |notifier| notifier.perform! @checkers end end |
Instance Attribute Details
#checkers ⇒ Object (readonly)
Returns the value of attribute checkers.
4 5 6 |
# File 'lib/checkzilla/model.rb', line 4 def checkers @checkers end |
#notifiers ⇒ Object (readonly)
Returns the value of attribute notifiers.
4 5 6 |
# File 'lib/checkzilla/model.rb', line 4 def notifiers @notifiers end |
Instance Method Details
#check_updates(klass, &block) ⇒ Object
22 23 24 |
# File 'lib/checkzilla/model.rb', line 22 def check_updates klass, &block @checkers << CheckZilla::Check.const_get(camelize(klass.to_s)).new(&block) end |
#notify_by(klass, &block) ⇒ Object
26 27 28 |
# File 'lib/checkzilla/model.rb', line 26 def notify_by klass, &block @notifiers << CheckZilla::Notifier.const_get(camelize(klass.to_s)).new(&block) end |