Skip to content

Commit

Permalink
Merge branch 'merged'
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Oct 3, 2010
2 parents e36beb4 + c00e7e2 commit aa8829c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/sass/util.rb
Expand Up @@ -121,10 +121,12 @@ def restrict(value, range)
# @example
# merge_adjacent_strings([1, "foo", "bar", 2, "baz"])
# #=> [1, "foobar", 2, "baz"]
# @param enum [Enumerable]
# @param arr [Array]
# @return [Array] The enumerable with strings merged
def merge_adjacent_strings(enum)
enum.inject([]) do |a, e|
def merge_adjacent_strings(arr)
# Optimize for the common case of one element
return arr if arr.size < 2
arr.inject([]) do |a, e|
if e.is_a?(String)
if a.last.is_a?(String)
a.last << e
Expand Down

0 comments on commit aa8829c

Please sign in to comment.