Sha256: fa141c88e5305e232145ee0f169fc9dc4ba8fb0483881ef86226be52f0648860
Contents?: true
Size: 434 Bytes
Versions: 2
Compression:
Stored size: 434 Bytes
Contents
class String def char_length self.split(//u).map{|i| i.bytes.length > 1 ? 2 : 1}.reduce(:+) end def char_length_with_t_co Tw::Conf.update_twitter_config len = self.char_length self.scan(Regexp.new "https?://[^\s]+").each do |url| len += (url =~ /^https/ ? Tw::Conf['twitter_config']['short_url_length_https'] : Tw::Conf['twitter_config']['short_url_length']) - url.char_length end len end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tw-1.3.1 | lib/tw/client/helper.rb |
tw-1.3.0 | lib/tw/client/helper.rb |