class Tamale::Builder

Public Class Methods

new(type) click to toggle source
# File lib/tamale.rb, line 176
def initialize(type)
  @type = type
end

Public Instance Methods

build(tag, attributes, contents = nil) click to toggle source
# File lib/tamale.rb, line 184
def build(tag, attributes, contents = nil)
  opening = build_opening(tag, attributes)

  @type.format(opening, contents, tag)
end
tags() click to toggle source
# File lib/tamale.rb, line 180
def tags
  @type.const_get(:TAGS)
end

Private Instance Methods

build_opening(tag, attributes) click to toggle source
# File lib/tamale.rb, line 192
def build_opening(tag, attributes)
  attributes.keys.inject(tag) { |acc, key| acc << " #{key}=\"#{attributes[key]}\"" }
end