Compare commits

...

3 Commits

Author SHA1 Message Date
Florian Weingarten
e77b1a09b6 Update gemspec 2013-11-11 08:57:22 -05:00
Florian Weingarten
73b39beef2 Update history 2013-11-11 08:56:56 -05:00
Dylan Thacker-Smith
fc63219087 Merge pull request #173 from jsw0528/master
fix `can't convert Fixnum into String` for `replace`
2013-11-11 08:54:03 -05:00
4 changed files with 11 additions and 7 deletions

View File

@@ -1,6 +1,10 @@
# Liquid Version History
## 2.5.3 / branch "2.5-stable"
## 2.5.4 / 2013-11-11 / branch "2.5-stable"
* Fix "can't convert Fixnum into String" for "replace", see #173, [wǒ_is神仙, jsw0528]
## 2.5.3 / 2013-10-09
* #232, #234, #237: Fix map filter bugs [Florian Weingarten, fw42]

View File

@@ -107,12 +107,12 @@ module Liquid
# Replace occurrences of a string with another
def replace(input, string, replacement = '')
input.to_s.gsub(string, replacement)
input.to_s.gsub(string, replacement.to_s)
end
# Replace the first occurrences of a string with another
def replace_first(input, string, replacement = '')
input.to_s.sub(string, replacement)
input.to_s.sub(string, replacement.to_s)
end
# remove a substring

View File

@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = "liquid"
s.version = "2.5.3"
s.version = "2.5.4"
s.platform = Gem::Platform::RUBY
s.summary = "A secure, non-evaling end user template engine with aesthetic markup."
s.authors = ["Tobias Luetke"]

View File

@@ -157,9 +157,9 @@ class StandardFiltersTest < Test::Unit::TestCase
end
def test_replace
assert_equal 'b b b b', @filters.replace("a a a a", 'a', 'b')
assert_equal 'b a a a', @filters.replace_first("a a a a", 'a', 'b')
assert_template_result 'b a a a', "{{ 'a a a a' | replace_first: 'a', 'b' }}"
assert_equal '2 2 2 2', @filters.replace('1 1 1 1', '1', 2)
assert_equal '2 1 1 1', @filters.replace_first('1 1 1 1', '1', 2)
assert_template_result '2 1 1 1', "{{ '1 1 1 1' | replace_first: '1', 2 }}"
end
def test_remove