integrate Ruby logic and flow control into the HTML generation process : HTML Builder « Network « Ruby






integrate Ruby logic and flow control into the HTML generation process


require 'rubygems'
require 'markaby'

m = Markaby::Builder.new

items = ['Bread', 'Butter', 'Tea', 'Coffee']

m.html do
  body do
    h1 'My Shopping List'
    ol do
      items.each do |item|
        li item
      end
    end
  end
end

puts m

 








Related examples in the same category

1.Markaby-Markup As Ruby