Class: Deplate::Regions::Mingle
- Inherits:
-
Deplate::Region
- Object
- Element
- Deplate::Region
- Deplate::Regions::Mingle
- Defined in:
- lib/deplate/template.rb
Instance Method Summary collapse
Methods inherited from Deplate::Region
check_file, clean_strings, #deprecated_regnote, deprecated_regnote, #finish_accum, #format_compound, regions, register_as, set_line_cont, #setup
Methods inherited from Element
#join_lines, #join_lines_re_zh_cn
Instance Method Details
#finish ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/deplate/template.rb', line 63 def finish finish_accum @doc_slot = nil @doc_type = nil slot = doc_slot type = doc_type case type when "pre", :pre array = @deplate..content_pre_matter when "body", :body array = @deplate..content_body when "post", :post array = @deplate..content_post_matter else log("Shouldn't be here", :error) end if array mingle_at(array, @deplate.slot_by_name(slot), @deplate.formatter.join_blocks(@accum)) end return nil end |
#mingle_at(array, slot, text) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/deplate/template.rb', line 85 def mingle_at(array, slot, text) if array[slot] array[slot] << text unless array[slot].include?(text) else array[slot] = [text] end end |