<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>activesupport/lib/active_support/core_ext/string/interpolation.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -7,3 +7,4 @@ require 'active_support/core_ext/string/access'
 require 'active_support/core_ext/string/iterators'
 require 'active_support/core_ext/string/xchar'
 require 'active_support/core_ext/string/behavior'
+require 'active_support/core_ext/string/interpolation'
\ No newline at end of file</diff>
      <filename>activesupport/lib/active_support/core_ext/string.rb</filename>
    </modified>
    <modified>
      <diff>@@ -280,3 +280,65 @@ class CoreExtStringMultibyteTest &lt; ActiveSupport::TestCase
     end
   end
 end
+
+=begin
+  string.rb - Interpolation for String.
+
+  Copyright (C) 2005-2009 Masao Mutoh
+ 
+  You may redistribute it and/or modify it under the same
+  license terms as Ruby.
+=end
+class TestGetTextString &lt; Test::Unit::TestCase
+  def test_sprintf
+    assert_equal(&quot;foo is a number&quot;, &quot;%{msg} is a number&quot; % {:msg =&gt; &quot;foo&quot;})
+    assert_equal(&quot;bar is a number&quot;, &quot;%s is a number&quot; % [&quot;bar&quot;])
+    assert_equal(&quot;bar is a number&quot;, &quot;%s is a number&quot; % &quot;bar&quot;)
+    assert_equal(&quot;1, test&quot;, &quot;%{num}, %{record}&quot; % {:num =&gt; 1, :record =&gt; &quot;test&quot;})
+    assert_equal(&quot;test, 1&quot;, &quot;%{record}, %{num}&quot; % {:num =&gt; 1, :record =&gt; &quot;test&quot;})
+    assert_equal(&quot;1, test&quot;, &quot;%d, %s&quot; % [1, &quot;test&quot;])
+    assert_equal(&quot;test, 1&quot;, &quot;%2$s, %1$d&quot; % [1, &quot;test&quot;])
+    assert_raise(ArgumentError) { &quot;%-%&quot; % [1] }
+  end
+
+  def test_percent
+    assert_equal(&quot;% 1&quot;, &quot;%% %&lt;num&gt;d&quot; % {:num =&gt; 1.0})
+    assert_equal(&quot;%{num} %&lt;num&gt;d&quot;, &quot;%%{num} %%&lt;num&gt;d&quot; % {:num =&gt; 1})
+  end
+
+  def test_sprintf_percent_in_replacement
+    assert_equal(&quot;%&lt;not_translated&gt;s&quot;, &quot;%{msg}&quot; % { :msg =&gt; '%&lt;not_translated&gt;s', :not_translated =&gt; 'should not happen' })
+  end
+
+  def test_sprintf_lack_argument
+    assert_equal(&quot;%{num}, test&quot;, &quot;%{num}, %{record}&quot; % {:record =&gt; &quot;test&quot;})
+    assert_equal(&quot;%{record}&quot;, &quot;%{record}&quot; % {:num =&gt; 1})
+  end
+
+  def test_no_placeholder
+    assert_equal(&quot;aaa&quot;, &quot;aaa&quot; % {:num =&gt; 1})
+    assert_equal(&quot;bbb&quot;, &quot;bbb&quot; % [1])
+  end
+
+  def test_sprintf_ruby19_style
+    assert_equal(&quot;1&quot;, &quot;%&lt;num&gt;d&quot; % {:num =&gt; 1})
+    assert_equal(&quot;0b1&quot;, &quot;%&lt;num&gt;#b&quot; % {:num =&gt; 1})
+    assert_equal(&quot;foo&quot;, &quot;%&lt;msg&gt;s&quot; % {:msg =&gt; &quot;foo&quot;})
+    assert_equal(&quot;1.000000&quot;, &quot;%&lt;num&gt;f&quot; % {:num =&gt; 1.0})
+    assert_equal(&quot;  1&quot;, &quot;%&lt;num&gt;3.0f&quot; % {:num =&gt; 1.0})
+    assert_equal(&quot;100.00&quot;, &quot;%&lt;num&gt;2.2f&quot; % {:num =&gt; 100.0})
+    assert_equal(&quot;0x64&quot;, &quot;%&lt;num&gt;#x&quot; % {:num =&gt; 100.0})
+    assert_raise(ArgumentError) { &quot;%&lt;num&gt;,d&quot; % {:num =&gt; 100} }
+    assert_raise(ArgumentError) { &quot;%&lt;num&gt;/d&quot; % {:num =&gt; 100} }
+  end
+
+  def test_sprintf_old_style
+    assert_equal(&quot;foo 1.000000&quot;, &quot;%s %f&quot; % [&quot;foo&quot;, 1.0])
+  end
+
+  def test_sprintf_mix
+    assert_equal(&quot;foo 1.000000&quot;, &quot;%{name} %&lt;num&gt;f&quot; % {:name =&gt; &quot;foo&quot;, :num =&gt; 1.0})
+    assert_equal(&quot;%{name} 1.000000&quot;, &quot;%{name} %f&quot; % [1.0])
+    assert_equal(&quot;%{name} 1.000000&quot;, &quot;%{name} %f&quot; % [1.0, 2.0])
+  end
+end</diff>
      <filename>activesupport/test/core_ext/string_ext_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>187d90f7529e02c3c863e6b68b45d8e34f315140</id>
    </parent>
  </parents>
  <author>
    <name>Lawrence Pit</name>
    <login>lawrencepit</login>
    <email>lawrence.pit@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/da635394c1c3004f4dacf4a35275404e5b1aef43</url>
  <id>da635394c1c3004f4dacf4a35275404e5b1aef43</id>
  <committed-date>2009-07-07T16:21:57-07:00</committed-date>
  <authored-date>2009-07-05T17:27:31-07:00</authored-date>
  <message>Ruby 1.9 style String interpolation support for lower ruby versions. Thanks to code from Masao Mutoh's GetText gem. [#2870 state:resolved]

Signed-off-by: Yehuda Katz &lt;wycats@yehuda-katzs-macbookpro41.local&gt;</message>
  <tree>2fc08f61477d70c761ea69b8ab577c383c5b34ff</tree>
  <committer>
    <name>Yehuda Katz</name>
    <login></login>
    <email>wycats@yehuda-katzs-macbookpro41.local</email>
  </committer>
</commit>
