File tree Expand file tree Collapse file tree 7 files changed +16
-33
lines changed Expand file tree Collapse file tree 7 files changed +16
-33
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ Htmless::Formatted.new.go_in do
15
15
head { title ' my_page' }
16
16
body do
17
17
div id: :content do
18
- p .centered " my page's content"
18
+ p " my page's content"
19
19
end
20
20
end
21
21
end
@@ -340,7 +340,7 @@ If they are needed they can be mixed directly into Builder's instance
340
340
Or new builder descendant can be made.
341
341
342
342
!!!ruby
343
- class MyBuilder < Hammer ::FormattedBuilder
343
+ class MyBuilder < Htmless ::FormattedBuilder
344
344
include ActionView::Helpers::NumberHelper
345
345
end
346
346
Original file line number Diff line number Diff line change 48
48
end
49
49
50
50
#out << " class AbstractTag\n" ff
51
- #HammerBuilder ::GLOBAL_ATTRIBUTES.each do |attr|
51
+ #Htmless ::GLOBAL_ATTRIBUTES.each do |attr|
52
52
# out << " \#@method #{attr}(value)\n"
53
53
# out << " attribute :#{attr}\n"
54
54
#end
Original file line number Diff line number Diff line change 17
17
# USA
18
18
19
19
require 'cgi'
20
- #require 'active_support/core_ext/string/inflections'
21
20
22
21
require 'htmless/dynamic_classes'
23
22
require 'htmless/strings_injector'
@@ -101,7 +100,7 @@ def #{tag}(*args, &block)
101
100
102
101
103
102
# creates a new builder
104
- # This is quite expensive, HammerBuilder ::Pool should be used
103
+ # This is quite expensive, Htmless ::Pool should be used
105
104
def initialize ( )
106
105
@_output = ""
107
106
@_stack = [ ]
@@ -115,6 +114,10 @@ def initialize()
115
114
end
116
115
end
117
116
117
+ def inspect
118
+ %Q{<Htmless::Abstract >}
119
+ end
120
+
118
121
# escapes +text+ to output
119
122
def text ( text )
120
123
flush
@@ -154,22 +157,9 @@ def reset
154
157
self
155
158
end
156
159
157
- #def capture
158
- # flush
159
- # _output = @_output.clone
160
- # _stack = @_stack.clone
161
- # @_output.clear
162
- # @_stack.clear
163
- # yield
164
- # to_html
165
- #ensure
166
- # @_output.replace _output
167
- # @_stack.replace _stack
168
- #end
169
-
170
160
# enables you to evaluate +block+ inside the builder with +variables+
171
161
# @example
172
- # HammerBuilder ::Formatted.new.go_in('asd') do |string|
162
+ # Htmless ::Formatted.new.go_in('asd') do |string|
173
163
# div string
174
164
# end.to_html #=> "<div>asd</div>"
175
165
#
Original file line number Diff line number Diff line change @@ -188,10 +188,5 @@ module Data
188
188
Attribute . new ( attr . to_sym , attribute_type [ name , attr ] )
189
189
end )
190
190
end )
191
-
192
- #require 'pp'
193
- #pp HTML5
194
- #pp HTML5.abstract_attributes
195
- #pp HTML5.simple_tags
196
191
end
197
192
end
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ module Helper
25
25
# @example
26
26
# class User
27
27
# # ...
28
- # include HammerBuilder ::Helper
28
+ # include Htmless ::Helper
29
29
#
30
30
# builder :menu do |user|
31
31
# li user.name
32
32
# end
33
33
# end
34
34
#
35
- # User.new.menu(HammerBuilder ::Standard.get).to_html! #=> "<li>Name</li>"
35
+ # User.new.menu(Htmless ::Standard.get).to_html! #=> "<li>Name</li>"
36
36
def builder ( method_name , &builder_block )
37
37
define_method ( method_name ) do |builder , *args |
38
38
builder . dive ( self , *args , &builder_block )
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ module Htmless
23
23
# pool = Pool.new Formatted
24
24
# pool.get.go_in do
25
25
# # some rendering
26
- # end.to_xhtml ! # => output and releases the builder to pool
26
+ # end.to_html ! # => output and releases the builder to pool
27
27
class Pool
28
28
29
29
module Helper
@@ -47,6 +47,10 @@ def initialize(klass)
47
47
klass . send :include , Helper
48
48
end
49
49
50
+ def inspect
51
+ %Q{<Htmless::Pool klass={@klass} #{ self . __id__ } >}
52
+ end
53
+
50
54
# This the preferred way of getting new Builder. If you forget to release it, it does not matter -
51
55
# builder gets GCed after you lose reference
52
56
# @return [Abstract]
Original file line number Diff line number Diff line change @@ -49,10 +49,4 @@ def initialize(controller)
49
49
go_in { render obj , "#{ options [ :method ] || options [ :template ] } " } . to_html! ,
50
50
:layout => true )
51
51
end
52
-
53
-
54
52
end
55
-
56
-
57
-
58
-
You can’t perform that action at this time.
0 commit comments