Sha256: e2b8298bfaa3e72c22ba53590740ece821f288eddf3d8181e68d5cc0f06aa6db

Contents?: true

Size: 645 Bytes

Versions: 10

Compression:

Stored size: 645 Bytes

Contents

module ActiveFedora::Aggregation
  class AppendsToAggregation < SimpleDelegator
    attr_reader :parent_node
    # @param [#next, #prev] proxy The proxy to add behavior to.
    # @param [#head, #tail] parent_node The aggregation to append proxies to.
    def initialize(proxy, parent_node)
      @parent_node = parent_node
      super(proxy)
    end

    def is_a?(klass)
      __getobj__.is_a?(klass)
    end

    def save(*args)
      insert_link do
        super
      end
    end

    private

    def insert_link
      result = yield
      if result
        LinkInserter.new(parent_node, self).call
      end
      result
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
activefedora-aggregation-0.9.0 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.8.1 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.8.0 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.7.0 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.6.0 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.5.0 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.4.2 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.4.1 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.4.0 lib/active_fedora/aggregation/appends_to_aggregation.rb
activefedora-aggregation-0.3.0 lib/active_fedora/aggregation/appends_to_aggregation.rb