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 20 21 22 23 |
# File 'lib/textus/builder/pipeline.rb', line 8 def self.call(content_hash, mentry) = { "generated_at" => Time.now.utc.iso8601 } if mentry.is_a?(Textus::Manifest::Entry::Derived) src = mentry.source if src.is_a?(Textus::Manifest::Entry::Derived::Projection) from = Array(src.select).compact ["from"] = from unless from.empty? ["reduce"] = src.transform if src.transform end end ["template"] = mentry.template if mentry.template out = { "_meta" => } content_hash.each { |k, v| out[k] = v unless k == "_meta" } out end |