builder 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module Builder
2
2
  VERSION_NUMBERS = [
3
3
  VERSION_MAJOR = 3,
4
4
  VERSION_MINOR = 1,
5
- VERSION_BUILD = 1,
5
+ VERSION_BUILD = 2,
6
6
  ]
7
7
  VERSION = VERSION_NUMBERS.join(".")
8
8
  end
@@ -177,11 +177,11 @@ module Builder
177
177
  # method_missing is very slow, this speeds up document generation
178
178
  # significantly.
179
179
  def cache_method_call(sym)
180
- instance_eval <<-NEW_METHOD
181
- def #{sym.to_s}(*args, &block)
182
- tag!(:#{sym.to_s}, *args, &block)
180
+ class << self; self; end.class_eval do
181
+ define_method(sym) do |*args, &block|
182
+ tag!(sym, *args, &block)
183
183
  end
184
- NEW_METHOD
184
+ end
185
185
  end
186
186
  end
187
187
 
@@ -28,6 +28,12 @@ class TestMethodCaching < Test::Unit::TestCase
28
28
  Builder::XmlBase.cache_method_calls = true
29
29
  end
30
30
 
31
+ def test_caching_does_not_break_weird_symbols
32
+ xml = Builder::XmlMarkup.new
33
+ xml.__send__("work-order", 1)
34
+ assert_equal "<work-order>1</work-order>", xml.target!
35
+ end
36
+
31
37
  def test_method_call_caching
32
38
  xml = Builder::XmlMarkup.new
33
39
  xml.cache_me
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Builder provides a number of builder objects that make creating structured
15
15
  data