Class: Krikri::AggregationEntityBehavior

Inherits:
EntityBehavior show all
Defined in:
lib/krikri/entity_behaviors/aggregation_entity_behavior.rb

Overview

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 Also:

Instance Attribute Summary

Attributes inherited from EntityBehavior

#activity

Instance Method Summary collapse

Methods inherited from EntityBehavior

entities, #initialize

Constructor Details

This class inherits a constructor from Krikri::EntityBehavior

Instance Method Details

#entities(load = true) ⇒ Enumerator

Returns DPLA::MAP::Aggregation objects.

Parameters:

  • load (Boolean) (defaults to: true)

    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.

Returns:

  • (Enumerator)

    DPLA::MAP::Aggregation objects

See Also:

  • EntityBehavior::entities


21
22
23
24
25
26
27
# File 'lib/krikri/entity_behaviors/aggregation_entity_behavior.rb', line 21

def entities(load = true)
  @activity.entity_uris.lazy.map do |uri|
    agg = DPLA::MAP::Aggregation.new(uri)
    agg.get if load
    agg
  end
end