Class: Icinga::Object
- Inherits:
-
Hash
- Object
- Hash
- Icinga::Object
- Defined in:
- lib/icinga/object.rb
Instance Method Summary collapse
-
#initialize(data) ⇒ Object
constructor
A new instance of Object.
- #method_missing(method, *args, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Object
Returns a new instance of Object.
7 8 9 10 11 |
# File 'lib/icinga/object.rb', line 7 def initialize(data) merge!(data) name_field = self.class.to_s.split("::").last.downcase self["name"] = data[name_field] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
13 14 15 |
# File 'lib/icinga/object.rb', line 13 def method_missing(method, *args, &block) self[method.to_s] end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/icinga/object.rb', line 17 def to_s self["name"] end |