class Interview::Builder
Attributes
curr_parent[RW]
html[RW]
Public Class Methods
new(options={})
click to toggle source
# File lib/interview/builder.rb, line 6 def initialize(options={}) @html = ::Builder::XmlMarkup.new end
Public Instance Methods
<<(text)
click to toggle source
# File lib/interview/builder.rb, line 44 def <<(text) @html << text end
add!(control, &block)
click to toggle source
# File lib/interview/builder.rb, line 14 def add!(control, &block) if @curr_parent.is_a? MetaControl and not @curr_parent.skip @curr_parent.build_child self, control, &block else control.parent = @curr_parent @curr_parent = control control.build self, &block @curr_parent = control.parent end end
add_abstract!(sym, *args, &block)
click to toggle source
# File lib/interview/builder.rb, line 25 def add_abstract!(sym, *args, &block) if Object.const_defined?(sym.to_s.camelcase) and Object.const_get(sym.to_s.camelcase) <= Interview::Control control = Object.const_get(sym.to_s.camelcase).new(*args) else # todo: prüfen, ob Control vorhanden control = Object.const_get("Interview::#{sym.to_s.camelcase}").new(*args) end add! control, &block end
lookup!(attr_name)
click to toggle source
# File lib/interview/builder.rb, line 48 def lookup!(attr_name) @curr_parent.find_attribute!(attr_name) end
method_missing(sym, *args, &block)
click to toggle source
# File lib/interview/builder.rb, line 52 def method_missing(sym, *args, &block) add_abstract!(sym, *args, &block) end
render!()
click to toggle source
# File lib/interview/builder.rb, line 10 def render! @html.target! end
tag!(sym, *args, &block)
click to toggle source
# File lib/interview/builder.rb, line 36 def tag!(sym, *args, &block) @html.tag!(sym, *args, &block) end
text!(text)
click to toggle source
# File lib/interview/builder.rb, line 40 def text!(text) @html.text!(text) end