Sha256: 31e40271368340d6109afb10978b1d2455cc5f7b3a76c62cce9a0440f5e0e958
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module Ddr class Item < Resource include HasChildren include HasParent include HasStructMetadata alias_method :collection_id, :parent_id alias_method :collection, :parent alias_method :components, :children ### DDRevo ##################### # TODO: We may want to revisit this alternate implementation once ddr-core is more fully baked # or it may be fine just as it is ### DDRevo ##################### def children_having_extracted_text # Ddr::Index::Query.build(self) do |item| # is_part_of item # where attached_files_having_content: "extractedText" # fields :id, :extracted_text # end children.select { |child| child.attached_files_having_content.include?(:extracted_text) } end ### DDRevo ##################### # TODO: We may want to revisit this alternate implementation once ddr-core is more fully baked # or it may be fine just as it is ### DDRevo ##################### def all_text # children_having_extracted_text.docs.map(&:extracted_text).flatten children_having_extracted_text.map { |child| child.extracted_text.content }.to_a.flatten end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ddr-core-0.2.2 | app/models/ddr/item.rb |
ddr-core-0.2.1 | app/models/ddr/item.rb |