Class: Connect::Objects::Host
- Inherits:
 - 
      Connect::ObjectDefinition
      
        
- Object
 - Hash
 - Connect::ObjectDefinition
 - Connect::Objects::Host
 
 
- Defined in:
 - lib/connect/objects/host.rb
 
Overview
Implements a object_type host. It add’s some automagic attributes like: hostname domain fqdn
Instance Attribute Summary
Attributes inherited from Connect::ObjectDefinition
Instance Method Summary collapse
- 
  
    
      #initialize(type, name, data)  ⇒ Host 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Host.
 
Methods inherited from Connect::ObjectDefinition
#add_reference, #full_representation, #merge!, #to_hash
Methods included from Conversions
#convert_array, #convert_array_entry, #convert_hash, #convert_hash_entry
Methods included from MethodHashMethods
Constructor Details
#initialize(type, name, data) ⇒ Host
Returns a new instance of Host.
      16 17 18 19 20 21 22 23 24 25  | 
    
      # File 'lib/connect/objects/host.rb', line 16 def initialize(type, name, data) super(type, name, data) begin self['hostname'] = name.split('.').first self['domain'] = name.split('.')[-2..-1].join('.') self['fqdn'] = name rescue raise ArgumentError, 'Invalid host object definition' end end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MethodHashMethods