class SlotMachine::Builder
A builder class base for the builder of the different partials
Attributes
output_buffer[RW]
Public Class Methods
new(template)
click to toggle source
# File lib/slot_machine/builder.rb, line 6 def initialize(template) @template = template end
Public Instance Methods
append_slot(name = :main, string = nil, &block)
click to toggle source
append the named slot
# File lib/slot_machine/builder.rb, line 11 def append_slot(name = :main, string = nil, &block) slots[name].concat(get_buffer(string, &block)) nil # why the fuck do I need this. It shouldn't put anything in the buffer but it does. end
Also aliased as: slot
get_buffer(string = nil) { || ... }
click to toggle source
capture the block if ther is one
# File lib/slot_machine/builder.rb, line 23 def get_buffer(string = nil, &block) return string unless block @template.capture { yield } end
slots()
click to toggle source
attribute reader
# File lib/slot_machine/builder.rb, line 18 def slots @slots ||= Hash.new { |h, k| h[k] = ActiveSupport::SafeBuffer.new('') } end