class Aspire::Enumerator::LinkedDataURIEnumerator
Enumerates the URI properties of a linked data API
object
Public Class Methods
new(yielder = nil, **hooks)
click to toggle source
Initialises a new LinkedDataAPIEnumerator instance @param yielder [Enumerator::Yielder] the yielder from an Enumerator
@param hooks [Hash] the callback hooks @yield [key, hash, index] passes each hash to the block @yieldparam key [Object] the hash property name @yieldparam hash [Hash] the hash @yieldparam index [Integer, nil] the index of the hash in its parent
array, or nil if not part of an array
Calls superclass method
Aspire::Enumerator::JSONEnumerator::new
# File lib/aspire/enumerator/linked_data_uri_enumerator.rb, line 16 def initialize(yielder = nil, **hooks) super(yielder, **hooks) # Yield only hashes { type: "uri", value: "..." } self[:before_hash] = proc do |key, hash, index| if hash['type'] == 'uri' && hash['value'] && !hash['value'].empty? self.yielder << [key, hash, index] false else true end end # Do not yield properties self[:before_yield] = proc { |_key, _value, _index| false } end