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.11.2 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.11.1 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.11.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.10.1 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.10.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.9.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.9 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.8 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.7 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.6 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.5 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.4 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.3 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.2 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.1 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.8.0 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.7.6 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.7.5 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.7.4 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb
krikri-0.7.3 lib/krikri/entity_behaviors/aggregation_entity_behavior.rb