Skip to content

Commit

Permalink
Simplify the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha committed Nov 14, 2024
1 parent 591a536 commit f206f7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/liquid/standardfilters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ def truncatewords(input, words = 15, truncate_string = "...")
# @liquid_category string
# @liquid_summary
# Splits a string into an array of substrings based on a given separator and an optional limit number
# @liquid_syntax string | split: string
# @liquid_syntax string | split: string, integer
# @liquid_return [array[string]]
def split(input, pattern, limit = nil)
limit = limit.respond_to?(:to_i) ? limit.to_i : 0
limit = Utils.to_number(limit).to_i

input.to_s.split(pattern.to_s, limit)
end
Expand Down

0 comments on commit f206f7e

Please sign in to comment.