class Masterpiece::HTML
Attributes
html_code[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/masterpiece.rb, line 9 def initialize(&block) instance_eval(&block) end
Private Instance Methods
comment(arg = nil)
click to toggle source
# File lib/masterpiece.rb, line 56 def comment(arg = nil) @html_code << %{<!-- #{arg} -->} end
method_missing(name,*args,&block)
click to toggle source
# File lib/masterpiece.rb, line 17 def method_missing(name,*args,&block) @html_code ||= '' if args.last == nil @html_code << %{<#{name}>} elsif args.last.class == Hash @html_code << %{<#{name} } args.last.each {|k,v| @html_code << %{#{k}="#{v}" }} args.first.class != Hash ? @html_code << %{>#{args.first}} : @html_code << %{>} #ingnore any string other than first one elsif args.last == args.first && args.last.class == String @html_code << %{<#{name}>#{args.first}} else @html_code << %{Something Wrong!!!} end if block_given? instance_eval(&block) end @html_code << %{</#{name}>} end