Sha256: 34cb52149ab57dd3572119fc1cb574dcc64a0f61a36625101781b783b7fe3959
Contents?: true
Size: 462 Bytes
Versions: 10
Compression:
Stored size: 462 Bytes
Contents
module ConsadoleAggregator class Helper def self.concat text, opt=Hash.new('') base = "#{text} #{opt[:url]} #{opt[:hashtag]}".squeeze(' ').rstrip if base.size > 140 over_size = base.size - 140 concat(omit(text, over_size), opt) else base end end private def self.omit text, over_size truncated = text.slice(0...-over_size) truncated[-3..-1] = '...' truncated end end end
Version data entries
10 entries across 10 versions & 1 rubygems