undies 3.0.0.rc.1 → 3.0.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- undies (3.0.0.rc.1)
4
+ undies (3.0.0.rc.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Rakefile CHANGED
@@ -24,9 +24,9 @@ namespace :bench do
24
24
  task :all do
25
25
  Rake::Task['test'].invoke
26
26
  puts
27
- Rake::Task['run_profiler'].invoke
27
+ Rake::Task['bench:profiler'].invoke
28
28
  puts
29
- Rake::Task['run_bench'].invoke
29
+ Rake::Task['bench:run'].invoke
30
30
  end
31
31
 
32
32
  end
@@ -191,8 +191,8 @@ class UndiesBenchRunner
191
191
 
192
192
  SIZES = [
193
193
  # [:small , "~500 nodes"],
194
- # [:large , "~5000 nodes"],
195
- [:verylarge, "~50000 nodes"]
194
+ [:large , "~5000 nodes"],
195
+ # [:verylarge, "~50000 nodes"]
196
196
  ]
197
197
 
198
198
 
data/lib/undies/api.rb CHANGED
@@ -86,23 +86,25 @@ module Undies
86
86
  alias_method :__element, :__open_element
87
87
  alias_method :__tag, :__open_element
88
88
 
89
- def __closed_element(name, *args, &build)
89
+ def __closed_element(name, *args)
90
90
  @_undies_io.
91
91
  current.
92
- element_node(ElementNode.new(@_undies_io, Element::Closed.new(name, *args, &build))).
92
+ element_node(ElementNode.new(
93
+ @_undies_io, Element::Closed.new(name, *args)
94
+ )).
93
95
  element
94
96
  end
95
97
  alias_method :__closed_tag, :__closed_element
96
98
 
97
- SELF_CLOSING_TAGS.each do |tag|
99
+ OPEN_TAGS.each do |tag|
98
100
  define_method("_#{tag}") do |*args, &build|
99
- __closed_element(tag, *args, &build)
101
+ __open_element(tag, *args, &build)
100
102
  end
101
103
  end
102
104
 
103
- OPEN_TAGS.each do |tag|
104
- define_method("_#{tag}") do |*args, &build|
105
- __open_element(tag, *args, &build)
105
+ SELF_CLOSING_TAGS.each do |tag|
106
+ define_method("_#{tag}") do |*args|
107
+ __closed_element(tag, *args)
106
108
  end
107
109
  end
108
110
 
@@ -1,3 +1,3 @@
1
1
  module Undies
2
- VERSION = "3.0.0.rc.1"
2
+ VERSION = "3.0.0.rc.2"
3
3
  end
@@ -11,7 +11,7 @@ class Undies::ElementNode
11
11
  before do
12
12
  # io test with :pp 1 so we can test newline insertion
13
13
  # io test with level 1 so we can test element start tag writing
14
- @io = Undies::IO.new(@out = "", :pp => 1, :level => 1)
14
+ @io = Undies::IO.new(@out = "", :pp => 1, :level => 2)
15
15
  @e = Undies::Element.open(:div, "hi")
16
16
  @en = Undies::ElementNode.new(@io, @e)
17
17
  end
@@ -146,20 +146,22 @@ class Undies::ElementNode
146
146
 
147
147
  should "write out the start tag with IO#newline when an element is given" do
148
148
  subject.element_node(@en1)
149
- assert_equal "<div>#{@io.newline}", @out
149
+ assert_equal "#{@io.line_indent(-1)}<div>#{@io.newline}", @out
150
150
  end
151
151
 
152
152
  should "write out any cached content and cache new markup when given" do
153
153
  subject.element_node @en1
154
154
  subject.element_node @en2
155
- assert_equal "<div>#{@io.newline}#{@io.line_indent}<strong>blah</strong>#{@io.newline}", @out
155
+ assert_equal "#{@io.line_indent(-1)}<div>#{@io.newline}#{@io.line_indent}<strong>blah</strong>#{@io.newline}", @out
156
156
  assert_equal @en2, subject.cached
157
157
  end
158
158
 
159
159
  should "write out the end tag with IO#newline indented when popped" do
160
160
  subject.element_node(@en1)
161
+ expected = "#{@io.line_indent(-1)}<div>#{@io.newline}#{@io.line_indent}<strong>blah</strong>#{@io.newline}#{@io.line_indent(-1)}</div>#{@io.newline}"
161
162
  subject.pop
162
- assert_equal "<div>#{@io.newline} <strong>blah</strong>#{@io.newline}</div>#{@io.newline}", @out
163
+
164
+ assert_equal expected, @out
163
165
  end
164
166
 
165
167
  end
@@ -174,13 +176,14 @@ class Undies::ElementNode
174
176
 
175
177
  should "write out the start tag with IO#newline when a partial is given" do
176
178
  subject.partial("partial markup")
177
- assert_equal "<div>#{@io.newline}", @out
179
+ assert_equal "#{@io.line_indent(-1)}<div>#{@io.newline}", @out
178
180
  end
179
181
 
180
182
  should "write out the end tag with IO#newline indented when a partial is given" do
181
183
  subject.partial(" partial markup\n")
184
+ expected = "#{@io.line_indent(-1)}<div>#{@io.newline}#{@io.line_indent}partial markup#{@io.newline}#{@io.line_indent(-1)}</div>#{@io.newline}"
182
185
  subject.pop
183
- assert_equal "<div>#{@io.newline} partial markup\n</div>#{@io.newline}", @out
186
+ assert_equal expected, @out
184
187
  end
185
188
 
186
189
  end
@@ -192,7 +195,7 @@ class Undies::ElementNode
192
195
  subject.attrs(:test => 'value')
193
196
  subject.element_node(@en1)
194
197
 
195
- assert_equal "<div test=\"value\">#{@io.newline}", @out
198
+ assert_equal "#{@io.line_indent(-1)}<div test=\"value\">#{@io.newline}", @out
196
199
  end
197
200
 
198
201
  should "not effect the start tag once child elements have been written" do
@@ -200,7 +203,7 @@ class Undies::ElementNode
200
203
  subject.element_node(@en1)
201
204
  subject.attrs(:another => 'val')
202
205
 
203
- assert_equal "<div test=\"value\">#{@io.newline}", @out
206
+ assert_equal "#{@io.line_indent(-1)}<div test=\"value\">#{@io.newline}", @out
204
207
  end
205
208
 
206
209
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undies
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424119
4
+ hash: 15424113
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
10
  - rc
11
- - 1
12
- version: 3.0.0.rc.1
11
+ - 2
12
+ version: 3.0.0.rc.2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Kelly Redding
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-04-11 00:00:00 Z
20
+ date: 2012-04-18 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  type: :development