Class: FuzzBert::Template
- Inherits:
-
Object
- Object
- FuzzBert::Template
- Includes:
- Generation
- Defined in:
- lib/fuzzbert/template.rb
Defined Under Namespace
Classes: Identifier, Parser, Text
Instance Method Summary collapse
-
#initialize(template) ⇒ Template
constructor
A new instance of Template.
- #set(name, cb = nil, &blk) ⇒ Object
- #to_data ⇒ Object
Methods included from Generation
Constructor Details
Instance Method Details
#set(name, cb = nil, &blk) ⇒ Object
11 12 13 |
# File 'lib/fuzzbert/template.rb', line 11 def set(name, cb=nil, &blk) @callbacks[name] = cb || blk end |
#to_data ⇒ Object
15 16 17 18 19 |
# File 'lib/fuzzbert/template.rb', line 15 def to_data "".tap do |buf| @template.each { |t| buf << t.to_data(@callbacks).to_s } end end |