Sha256: fa1b9a6e0837b66ba7048025c6650717cb390ad49e9fd5b6c4fff25c21a1fbe0
Contents?: true
Size: 843 Bytes
Versions: 4
Compression:
Stored size: 843 Bytes
Contents
module Mab class SimpleBuilder include Mixin def initialize(assigns = {}, helper = nil, &blk) @_helper = helper @_result = [] assigns.each do |key, value| instance_variable_set(:"@#{key}", value) end if helper helper.instance_variables.each do |var| instance_variable_set(var, helper.instance_variable_get(var)) end end capture(&blk) if blk end def capture(&blk) @_result << mab(&blk) end def to_s; @_result.join end def method_missing(name, *args, &blk) if @_helper && @_helper.respond_to?(name, true) @_helper.send(name, *args, &blk) else super end end end class Builder < SimpleBuilder include HTML5 end class PrettyBuilder < Builder include Indentation end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
mab-cj-0.0.4 | lib/mab/builder.rb |
mab-0.0.3 | lib/mab/builder.rb |
mab-0.0.2 | lib/mab/builder.rb |
mab-0.0.1 | lib/mab/builder.rb |