Sha256: dbe4816e6cfbca3de1a31ef313defe560326e436087a77303c9a7b609e7fc121

Contents?: true

Size: 938 Bytes

Versions: 32

Compression:

Stored size: 938 Bytes

Contents

module Krikri
  ##
  # A behavior that provides methods for working with aggregations
  # (as defined by DPLA::MAP::Aggregation), in the context of entities that
  # are generated by activities.
  #
  # @see Krikri::EntityBehavior
  #
  class AggregationEntityBehavior < Krikri::EntityBehavior

    ##
    # @param load [Boolean]  Whether to load the whole record from the LDP
    #                        server.  Default: true.
    #                        DPLA::MAP::Aggregation#get is slow, because it
    #                        results in a network request, so this provides the
    #                        possibility of avoiding it.
    # @see Krikri::EntityBehavior::entities
    # @return [Enumerator] DPLA::MAP::Aggregation objects
    #
    def entities(load = true)
      @activity.entity_uris.lazy.map do |uri|
        agg = DPLA::MAP::Aggregation.new(uri)
        agg.get if load
        agg
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
krikri-0.7.2 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.7.1 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.7.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.6.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.7 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.6 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.5 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.4 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.3 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.2 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.1 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.5.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb