module HTree::GeneratorModule
Public Instance Methods
add_args(args)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 43 def add_args(args) args.flatten.map {|arg| symbol_to_hash(arg) } end
add_elems(args)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 49 def add_elems(args) return [] if args.nil? return [args] unless args.kind_of? Array ar = [] args.each {|a| next if a.nil? ar << a } ar = [''] if ar.empty? ar end
make(symbol, *args, &block)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 20 def make(symbol, *args, &block) ar = make_ar(symbol, *args, &block) Elem.new(*ar) end
make_ar(symbol, *args, &block)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 25 def make_ar(symbol, *args, &block) ar = [] ar << symbol.to_s.gsub(/_/, '-') # tag name if 0 < args.length a = add_args(args) ar += a end if block y = block.call ar += add_elems(y) end ar end
method_missing(symbol, *args, &block)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 12 def method_missing(symbol, *args, &block) make(symbol, *args, &block) end
p(*args, &block)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 16 def p(*args, &block) make(:p, *args, &block) end
symbol_to_hash(s)
click to toggle source
# File vendor/qwik/lib/qwik/htree-generator.rb, line 61 def symbol_to_hash(s) h = {} s.each {|k, v| next if v.nil? h[k.to_s] = v.to_s } h end