lib/render/text/helper/string.rb in render-text-helper-0.2.0 vs lib/render/text/helper/string.rb in render-text-helper-0.3.0
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
# Adds function to existing String class
class String
# output the string giving the limit. It does not touch the string
- def limit_print(limit: 32, more_indicator: '.')
+ def limit_print(limit: 32, more_indicator: '.', indicator_length: 3)
return self if size < limit
- [self[0...limit], more_indicator, more_indicator, more_indicator].join
+ [self[0...limit], (more_indicator * indicator_length)].join
end
end