lib/cocoa/sugarcube-attributedstring/nsattributedstring.rb in sugarcube-3.1.1 vs lib/cocoa/sugarcube-attributedstring/nsattributedstring.rb in sugarcube-3.2.0

- old
+ new

@@ -146,5 +146,19 @@ def <<(attributedstring) self.appendAttributedString(attributedstring.nsattributedstring) end end + +class Array + + # Detects if any part of an array is an NSAttributedString and joins them + # Otherwise, just joins the array. + def join_attrd(connector=nil) + joining = "".attrd + each_with_index do |attrd_str, index| + joining << connector if connector && index > 0 + joining << attrd_str + end + joining + end +end