Class: Easymon::Repository
- Inherits:
-
Object
- Object
- Easymon::Repository
- Defined in:
- lib/easymon/repository.rb
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Class Method Summary collapse
- .add(name, check, is_critical = false) ⇒ Object
- .all ⇒ Object
- .critical ⇒ Object
- .fetch(name) ⇒ Object
- .names ⇒ Object
- .remove(name) ⇒ Object
- .repository ⇒ Object
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
3 4 5 |
# File 'lib/easymon/repository.rb', line 3 def repository @repository end |
Class Method Details
.add(name, check, is_critical = false) ⇒ Object
19 20 21 22 |
# File 'lib/easymon/repository.rb', line 19 def self.add(name, check, is_critical=false) entry = {:check => check, :critical => is_critical ? true : false} repository[name] = entry end |
.all ⇒ Object
11 12 13 |
# File 'lib/easymon/repository.rb', line 11 def self.all Checklist.new repository end |
.critical ⇒ Object
32 33 34 |
# File 'lib/easymon/repository.rb', line 32 def self.critical repository.map{ |name, entry| name if entry[:critical] }.compact end |
.fetch(name) ⇒ Object
5 6 7 8 9 |
# File 'lib/easymon/repository.rb', line 5 def self.fetch(name) return repository.fetch(name) rescue IndexError raise NoSuchCheck, "No check named '#{name}'" end |
.names ⇒ Object
15 16 17 |
# File 'lib/easymon/repository.rb', line 15 def self.names repository.keys end |
.remove(name) ⇒ Object
24 25 26 |
# File 'lib/easymon/repository.rb', line 24 def self.remove(name) repository.delete(name) end |
.repository ⇒ Object
28 29 30 |
# File 'lib/easymon/repository.rb', line 28 def self.repository @repository ||= {} end |