Class: ZBX::Entity
- Inherits:
-
Object
- Object
- ZBX::Entity
- Defined in:
- lib/zbx/entity.rb
Overview
zabbix entity class e.g. host, group, item, graph …
Instance Method Summary collapse
-
#initialize(entity, parent, &b) ⇒ Entity
constructor
entitiy name, zapix object if block is given, it will be evaluated in this object so the following expression is the same.
- #method_missing(m, arg = {}) ⇒ Object
Constructor Details
#initialize(entity, parent, &b) ⇒ Entity
entitiy name, zapix object if block is given, it will be evaluated in this object so the following expression is the same
host.get(hostids: 1)
host do
get hostids: 1
end
16 17 18 19 20 |
# File 'lib/zbx/entity.rb', line 16 def initialize entity, parent, &b @entity = entity @parent = parent instance_eval(&b) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, arg = {}) ⇒ Object
22 23 24 |
# File 'lib/zbx/entity.rb', line 22 def method_missing m, arg={} @parent.request "#{@entity}.#{m}", arg end |