Class: ActiveFedora::Aggregation::LinkInserter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/aggregation/link_inserter.rb

Defined Under Namespace

Classes: Appender

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, proxy) ⇒ LinkInserter

Returns a new instance of LinkInserter.

Parameters:

  • root (ProxyOwner)

    the node representing the aggregation

  • proxy (Proxy)

    the proxy to add to the aggregation



6
7
8
9
# File 'lib/active_fedora/aggregation/link_inserter.rb', line 6

def initialize(root, proxy)
  @root = root
  @proxy = proxy
end

Instance Attribute Details

#proxyObject (readonly)

Returns the value of attribute proxy.



3
4
5
# File 'lib/active_fedora/aggregation/link_inserter.rb', line 3

def proxy
  @proxy
end

#rootObject (readonly)

Returns the value of attribute root.



3
4
5
# File 'lib/active_fedora/aggregation/link_inserter.rb', line 3

def root
  @root
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
# File 'lib/active_fedora/aggregation/link_inserter.rb', line 11

def call
  if root.head
    append
  else
    set
  end
  proxy.container = root
  persist_nodes!
end