Class: ActiveFedora::Merged
- Inherits:
- 
      AssociationHash
      
        - Object
- AssociationHash
- ActiveFedora::Merged
 
- Defined in:
- lib/active_fedora/association_hash.rb
Overview
    Note:
    
  
As the keys can come from multiple models, the attributes become
Represents the result of merging two association hashes. unwritable.
Instance Attribute Summary collapse
- 
  
    
      #first  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute first. 
- 
  
    
      #second  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute second. 
Attributes inherited from AssociationHash
Instance Method Summary collapse
- 
  
    
      #[](name)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    rubocop:enable Lint/MissingSuper. 
- #[]=(_name) ⇒ Object
- 
  
    
      #initialize(first, second)  ⇒ Merged 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    rubocop:disable Lint/MissingSuper. 
- #keys ⇒ Object
Methods inherited from AssociationHash
#association, #changed, #each, #each_value, #freeze, #key?, #merge, #select, #values
Constructor Details
#initialize(first, second) ⇒ Merged
rubocop:disable Lint/MissingSuper
| 96 97 98 99 100 | # File 'lib/active_fedora/association_hash.rb', line 96 def initialize(first, second) @first = first @base = first.base @second = second end | 
Instance Attribute Details
#first ⇒ Object (readonly)
Returns the value of attribute first.
| 93 94 95 | # File 'lib/active_fedora/association_hash.rb', line 93 def first @first end | 
#second ⇒ Object (readonly)
Returns the value of attribute second.
| 93 94 95 | # File 'lib/active_fedora/association_hash.rb', line 93 def second @second end | 
Instance Method Details
#[](name) ⇒ Object
rubocop:enable Lint/MissingSuper
| 103 104 105 | # File 'lib/active_fedora/association_hash.rb', line 103 def [](name) first[name] || second[name] end | 
#[]=(_name) ⇒ Object
| 107 108 109 | # File 'lib/active_fedora/association_hash.rb', line 107 def []=(_name) raise NotImplementedError, "Unable to set properties on a merged association hash." end | 
#keys ⇒ Object
| 111 112 113 | # File 'lib/active_fedora/association_hash.rb', line 111 def keys first.keys + second.keys end |