Compare commits

..

6 Commits

Author SHA1 Message Date
Justin Li
e99c7e2eec Force #to_liquid call in InputIterator#each 2016-02-01 11:44:54 -05:00
Justin Li
08de6ed2c5 Merge pull request #687 from pathawks/default
Performance improvement: `default` filter
2016-01-24 11:34:05 -05:00
Pat Hawks
7e322f5cf8 Performance improvement: default filter 2016-01-23 23:18:51 -08:00
Justin Li
bf86a5a069 Merge pull request #688 from Shopify/gmp
Install libgmp3-dev in travis
2016-01-23 21:46:37 -05:00
Justin Li
0141444814 Install libgmp3-dev in travis 2016-01-23 21:41:14 -05:00
Justin Li
6d30226768 Update changelog for 4.0.0rc1 2016-01-08 15:08:06 -05:00
4 changed files with 23 additions and 5 deletions

View File

@@ -10,6 +10,11 @@ rvm:
sudo: false
addons:
apt:
packages:
- libgmp3-dev
matrix:
allow_failures:
- rvm: jruby-head

View File

@@ -3,6 +3,8 @@
## 4.0.0 / not yet released / branch "master"
### Changed
* Improve loop performance (#681) [Florian Weingarten]
* Rename Drop method `before_method` to `liquid_method_missing` (#661) [Thierry Joyal]
* Add url_decode filter to invert url_encode (#645) [Larry Archer]
* Add global_filter to apply a filter to all output (#610) [Loren Hale]
* Add compact filter (#600) [Carson Reinke]
@@ -15,9 +17,11 @@
* Ruby 1.9 support dropped (#491) [Justin Li]
* Liquid::Template.file_system's read_template_file method is no longer passed the context. (#441) [James Reid-Smith]
* Remove support for `liquid_methods`
* Rename Drop method `before_method` as `liquid_method_missing` (#661) [Thierry Joyal]
### Fixed
* Fix map filter when value is a Proc (#672) [Guillaume Malette]
* Fix truncate filter when value is not a string (#672) [Guillaume Malette]
* Fix behaviour of escape filter when input is nil (#665) [Tanel Jakobsoo]
* Fix sort filter behaviour with empty array input (#652) [Marcel Cary]
* Fix test failure under certain timezones (#631) [Dylan Thacker-Smith]
* Fix bug in uniq filter (#595) [Florian Weingarten]

View File

@@ -60,3 +60,9 @@ class NilClass
self
end
end
class Proc
def to_liquid # :nodoc:
self
end
end

View File

@@ -341,9 +341,12 @@ module Liquid
raise Liquid::FloatDomainError, e.message
end
def default(input, default_value = "".freeze)
is_blank = input.respond_to?(:empty?) ? input.empty? : !input
is_blank ? default_value : input
def default(input, default_value = ''.freeze)
if !input || input.respond_to?(:empty?) && input.empty?
default_value
else
input
end
end
private
@@ -395,7 +398,7 @@ module Liquid
def each
@input.each do |e|
yield(e.respond_to?(:to_liquid) ? e.to_liquid : e)
yield(e.to_liquid)
end
end
end