Class: DocumentRenderer::Part
- Inherits:
-
Object
- Object
- DocumentRenderer::Part
- Defined in:
- lib/document_renderer/part.rb
Constant Summary collapse
- PART_RE =
/{{[^}]+}}/.freeze
Class Method Summary collapse
Class Method Details
.call(content, options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/document_renderer/part.rb', line 8 def call(content, ) @excludes = [:excludes] || [] content.gsub(PART_RE) do |placeholder| next unless placeholder next unless (part = [:parts_index][placeholder]) next unless (subpart = part[:content]) next unless should_render?(part, omit_optional: ![:with_optional]) call subpart.to_s, end end |