builder 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of builder might be problematic. Click here for more details.

data/CHANGES CHANGED
@@ -1,5 +1,14 @@
1
1
  = Change Log
2
2
 
3
+ == Version 1.2.2
4
+
5
+ Another fix for BlankSlate. The Kernal/Object traps added in 1.2.1
6
+ failed when a method was defined late more than once. Since the
7
+ method was already marked as removed, another attempt to undefine it
8
+ raised an error. The fix was to check the list of instance methods
9
+ before attempting the undef operation. Thanks to Florian Gross and
10
+ David Heinemeier Hansson for the patch.
11
+
3
12
  == Version 1.2.1
4
13
 
5
14
  BlankSlate now traps method definitions in Kernel and Object to avoid
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ rescue Exception
17
17
  nil
18
18
  end
19
19
 
20
- PKG_VERSION = "1.2.1"
20
+ PKG_VERSION = "1.2.2"
21
21
 
22
22
  SRC_RB = FileList['lib/**/*.rb']
23
23
 
@@ -17,7 +17,9 @@ module Builder
17
17
  class BlankSlate
18
18
  class << self
19
19
  def hide(name)
20
- undef_method name unless name =~ /^(__|instance_eval)/
20
+ undef_method name if
21
+ instance_methods.include?(name.to_s) and
22
+ name !~ /^(__|instance_eval)/
21
23
  end
22
24
  end
23
25
 
@@ -77,7 +77,7 @@ module Builder
77
77
  # Append text to the output target. Escape any markup. May be
78
78
  # used within the markup brakets as:
79
79
  #
80
- # builder.p { br; text! "HI" } #=> <p><br/>HI</p>
80
+ # builder.p { |b| b.br; b.text! "HI" } #=> <p><br/>HI</p>
81
81
  def text!(text)
82
82
  _text(_escape(text))
83
83
  end
@@ -93,7 +93,7 @@ module Builder
93
93
  #
94
94
  # It is also useful for stacking builder objects. Builders only
95
95
  # use <tt><<</tt> to append to the target, so by supporting this
96
- # method/operation builders can use oother builders as their
96
+ # method/operation builders can use other builders as their
97
97
  # targets.
98
98
  def <<(text)
99
99
  _text(text)
data/test/preload.rb CHANGED
@@ -6,22 +6,24 @@
6
6
 
7
7
  module Kernel
8
8
  class << self
9
- attr_reader :k_added_name
9
+ attr_reader :k_added_names
10
10
  alias_method :preload_method_added, :method_added
11
11
  def method_added(name)
12
12
  preload_method_added(name)
13
- @k_added_name = name
13
+ @k_added_names ||= []
14
+ @k_added_names << name
14
15
  end
15
16
  end
16
17
  end
17
18
 
18
19
  class Object
19
20
  class << self
20
- attr_reader :o_added_name
21
+ attr_reader :o_added_names
21
22
  alias_method :preload_method_added, :method_added
22
23
  def method_added(name)
23
24
  preload_method_added(name)
24
- @o_added_name = name
25
+ @o_added_names ||= []
26
+ @o_added_names << name
25
27
  end
26
28
  end
27
29
  end
@@ -8,8 +8,18 @@ module Kernel
8
8
  def late_addition
9
9
  1234
10
10
  end
11
+
12
+ def double_late_addition
13
+ 11
14
+ end
15
+
16
+ def double_late_addition
17
+ 22
18
+ end
11
19
  end
12
20
 
21
+
22
+
13
23
  class Object
14
24
  def another_late_addition
15
25
  4321
@@ -36,8 +46,12 @@ class TestBlankSlate < Test::Unit::TestCase
36
46
  end
37
47
 
38
48
  def test_preload_method_added
39
- assert_equal :late_addition, Kernel.k_added_name
40
- assert_equal :another_late_addition, Object.o_added_name
49
+ assert Kernel.k_added_names.include?(:late_addition)
50
+ assert Object.o_added_names.include?(:another_late_addition)
51
+ end
52
+
53
+ def test_double_defined_method
54
+ assert_raise(NoMethodError) { @bs.double.late_addition }
41
55
  end
42
56
  end
43
57
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: builder
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.1
7
- date: 2004-10-30
6
+ version: 1.2.2
7
+ date: 2004-11-23
8
8
  summary: Builders for MarkUp.
9
9
  require_paths:
10
10
  - lib
@@ -27,20 +27,20 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
27
27
  platform: ruby
28
28
  files:
29
29
  - lib/builder.rb
30
- - lib/builder/xmlmarkup.rb
31
- - lib/builder/xmlbase.rb
32
30
  - lib/builder/blankslate.rb
31
+ - lib/builder/xmlbase.rb
33
32
  - lib/builder/xmlevents.rb
34
- - test/testmarkupbuilder.rb
35
- - test/testblankslate.rb
33
+ - lib/builder/xmlmarkup.rb
36
34
  - test/preload.rb
35
+ - test/testblankslate.rb
36
+ - test/testmarkupbuilder.rb
37
37
  - scripts/publish.rb
38
+ - CHANGES
38
39
  - README
39
40
  - Rakefile
40
- - CHANGES
41
41
  test_files:
42
- - test/testmarkupbuilder.rb
43
42
  - test/testblankslate.rb
43
+ - test/testmarkupbuilder.rb
44
44
  rdoc_options:
45
45
  - "--title"
46
46
  - "Builder -- Easy XML Building"
@@ -48,9 +48,9 @@ rdoc_options:
48
48
  - README
49
49
  - "--line-numbers"
50
50
  extra_rdoc_files:
51
+ - CHANGES
51
52
  - README
52
53
  - Rakefile
53
- - CHANGES
54
54
  executables: []
55
55
  extensions: []
56
56
  requirements: []