Module: Textus::Builder::InjectMeta
- Defined in:
- lib/textus/builder/pipeline.rb
Class Method Summary collapse
-
.call(content_hash, mentry) ⇒ Object
Returns a new hash with _meta as the first key, per SPEC §6 ordering.
Class Method Details
.call(content_hash, mentry) ⇒ Object
Returns a new hash with _meta as the first key, per SPEC §6 ordering.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/textus/builder/pipeline.rb', line 8 def self.call(content_hash, mentry) = { "generated_at" => Time.now.utc.iso8601 } from = Array(mentry.projection&.fetch("select", nil)).compact ["from"] = from unless from.empty? ["template"] = mentry.template if mentry.template reduce = mentry.projection&.dig("reduce") ["reduce"] = reduce if reduce out = { "_meta" => } content_hash.each { |k, v| out[k] = v unless k == "_meta" } out end |