Class: Connect::ObjectDefinition
- Inherits:
 - 
      Hash
      
        
- Object
 - Hash
 - Connect::ObjectDefinition
 
 
- Includes:
 - Conversions, MethodHashMethods
 
- Defined in:
 - lib/connect/object_definition.rb
 
Overview
This class represents an entry in the object definitions table. An object is identified by a type and a name and it contains values.
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #xref  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute xref.
 
Instance Method Summary collapse
- #add_reference(reference) ⇒ Object
 - 
  
    
      #full_representation  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Translate the current object to an external representation.
 - 
  
    
      #initialize(type, name, data)  ⇒ ObjectDefinition 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initialize a object definition for the object table and the value table.
 - 
  
    
      #merge!(data)  ⇒ ObjectDefinition 
    
    
  
  
  
  
  
  
  
  
  
    
merge the specfied data with the data already available in the object.
 - 
  
    
      #to_hash  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Translate the object values to a 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) ⇒ ObjectDefinition
Initialize a object definition for the object table and the value table
      26 27 28 29 30 31 32 33 34 35 36  | 
    
      # File 'lib/connect/object_definition.rb', line 26 def initialize(type, name, data) @xref = [] identify(type, name) # # To make sure there are no lookup problems mixing # symbols and strins, we force all keys to strings # data.extend(HashExtensions) data = data.stringify_keys self.merge!(data) end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MethodHashMethods
Instance Attribute Details
#xref ⇒ Object (readonly)
Returns the value of attribute xref.
      16 17 18  | 
    
      # File 'lib/connect/object_definition.rb', line 16 def xref @xref end  | 
  
Instance Method Details
#add_reference(reference) ⇒ Object
      52 53 54 55  | 
    
      # File 'lib/connect/object_definition.rb', line 52 def add_reference(reference) @xref << reference @xref = @xref.flatten.compact end  | 
  
#full_representation ⇒ Hash
Translate the current object to an external representation
      63 64 65  | 
    
      # File 'lib/connect/object_definition.rb', line 63 def full_representation ObjectRepresentation[__name__, without_private_entries] end  | 
  
#merge!(data) ⇒ ObjectDefinition
merge the specfied data with the data already available in the object. Attributes already avialble, will be overwritten.
      46 47 48 49 50  | 
    
      # File 'lib/connect/object_definition.rb', line 46 def merge!(data) data.extend(HashExtensions) data = data.stringify_keys super(data) end  | 
  
#to_hash ⇒ Hash
Translate the object values to a Hash
      73 74 75  | 
    
      # File 'lib/connect/object_definition.rb', line 73 def to_hash without_private_entries end  |