Class: Aspire::Enumerator::LinkedDataURIEnumerator
- Inherits:
-
JSONEnumerator
- Object
- JSONEnumerator
- Aspire::Enumerator::LinkedDataURIEnumerator
- Defined in:
- lib/aspire/enumerator/linked_data_uri_enumerator.rb
Overview
Enumerates the URI properties of a linked data API object
Instance Attribute Summary
Attributes inherited from JSONEnumerator
Instance Method Summary collapse
-
#initialize(yielder = nil, **hooks) {|key, hash, index| ... } ⇒ LinkedDataURIEnumerator
constructor
Initialises a new LinkedDataAPIEnumerator instance.
Methods inherited from JSONEnumerator
#[], #[]=, #array, #enumerate, #enumerator, #hash, #property
Constructor Details
#initialize(yielder = nil, **hooks) {|key, hash, index| ... } ⇒ LinkedDataURIEnumerator
Initialises a new LinkedDataAPIEnumerator instance
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# 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 |