Class: Krikri::OriginalRecordEntityBehavior

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

Overview

A behavior that provides methods for working with original records (as defined by Krikri::OriginalRecord), 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 OriginalRecord objects.

Parameters:

  • load (Boolean) (defaults to: true)

    Whether to load the whole record from the LDP server. Default: true. OriginalRecord.load is slow, because it results in a network request, so this provides the possibility of avoiding it.

Returns:

  • (Enumerator)

    OriginalRecord objects

See Also:

  • EntityBehavior::entities


20
21
22
23
24
# File 'lib/krikri/entity_behaviors/original_record_entity_behavior.rb', line 20

def entities(load = true)
  @activity.entity_uris.lazy.map do |uri|
    load ? OriginalRecord.load(uri) : OriginalRecord.new(uri)
  end
end