lib/render/text/helper/string.rb in render-text-helper-0.3.0 vs lib/render/text/helper/string.rb in render-text-helper-0.3.1

- old
+ new

@@ -6,6 +6,16 @@ def limit_print(limit: 32, more_indicator: '.', indicator_length: 3) return self if size < limit [self[0...limit], (more_indicator * indicator_length)].join end + + # outputs an array + def to_smart_array(separator = nil) + return [] if nil? + + return split(separator).map(&:strip) unless separator.nil? + return split(',').map(&:strip) if include?(',') + + split.map(&:strip) + end end