Class: AlertDesigner::Check

Inherits:
BasicObject
Defined in:
lib/alertdesigner/check.rb

Overview

Class to represent a check

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description) ⇒ Check

Returns a new instance of Check.



4
5
6
7
8
9
# File 'lib/alertdesigner/check.rb', line 4

def initialize(description)
  @attributes = {}
  @description = description
  @command = ""
  @hostgroups = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



23
24
25
# File 'lib/alertdesigner/check.rb', line 23

def method_missing(name, *args)
  attributes[name] = args[0]
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



21
22
23
# File 'lib/alertdesigner/check.rb', line 21

def attributes
  @attributes
end

#descriptionObject (readonly)

Returns the value of attribute description.



21
22
23
# File 'lib/alertdesigner/check.rb', line 21

def description
  @description
end

Instance Method Details

#command(command = nil) ⇒ Object



11
12
13
14
# File 'lib/alertdesigner/check.rb', line 11

def command(command = nil)
  return @command if command.nil?
  @command = command
end

#hostgroups(groups = nil) ⇒ Object



16
17
18
19
# File 'lib/alertdesigner/check.rb', line 16

def hostgroups(groups = nil)
  return @hostgroups if groups.nil?
  @hostgroups = groups
end