html-builder 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/html-builder.rb +24 -0
- metadata +1 -1
data/lib/html-builder.rb
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
class HtmlBuilder
|
4
|
+
# HtmlBuilder
|
5
|
+
#
|
6
|
+
# Example:
|
7
|
+
# require 'html-builder'
|
8
|
+
#
|
9
|
+
# puts HtmlBuilder.html {
|
10
|
+
# head {
|
11
|
+
# title "Hello HtmlBuilder"
|
12
|
+
# }
|
13
|
+
# body {
|
14
|
+
# text "Hello ", a("HtmlBuilder", :href => "http://github.com/jinchizhong/html-builder"), "."
|
15
|
+
# }
|
16
|
+
# }
|
17
|
+
# Got:
|
18
|
+
# <html>
|
19
|
+
# <head>
|
20
|
+
# <title>Hello HtmlBuilder</title>
|
21
|
+
# </head>
|
22
|
+
# <body>
|
23
|
+
# Hello <a href="http://github.com/jinchizhong/html-builder">HtmlBuilder</a>.
|
24
|
+
# </body>
|
25
|
+
# </html>
|
26
|
+
# Just so easy...
|
27
|
+
|
4
28
|
def initialize name, attrs, text
|
5
29
|
@name = name
|
6
30
|
@attrs = attrs
|