use reduce to format strings

This commit is contained in:
Ben Balter 2017-04-11 15:19:17 -05:00
parent 8cb5953ea4
commit 650fe5c1fd
No known key found for this signature in database
GPG Key ID: DBB67C246AD356C4
1 changed files with 2 additions and 2 deletions

View File

@ -207,8 +207,8 @@ module Jekyll
end
def format_string(string)
FORMAT_STRING_METHODS.each do |method|
string = filters.public_send(method, string)
string = FORMAT_STRING_METHODS.reduce(string) do |memo, method|
filters.public_send(method, memo)
end
string unless string.empty?