Sha256: dda8f23984ba14ad18dfd1a8b662593caa6e6335c042ca6e80c807d2ff3bb2e6

Contents?: true

Size: 392 Bytes

Versions: 32

Compression:

Stored size: 392 Bytes

Contents

class String

  def char_length
    self.split(//u).size
  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

32 entries across 32 versions & 1 rubygems

Version Path
tw-1.2.1 lib/tw/client/helper.rb
tw-1.2.0 lib/tw/client/helper.rb
tw-1.1.1 lib/tw/client/helper.rb
tw-1.1.0 lib/tw/client/helper.rb
tw-1.0.12 lib/tw/client/helper.rb
tw-1.0.11 lib/tw/client/helper.rb
tw-1.0.10 lib/tw/client/helper.rb
tw-1.0.9 lib/tw/client/helper.rb
tw-1.0.8 lib/tw/client/helper.rb
tw-1.0.7 lib/tw/client/helper.rb
tw-1.0.6 lib/tw/client/helper.rb
tw-1.0.5 lib/tw/client/helper.rb
tw-1.0.4 lib/tw/client/helper.rb
tw-1.0.3 lib/tw/client/helper.rb
tw-1.0.2 lib/tw/client/helper.rb
tw-1.0.1 lib/tw/client/helper.rb
tw-1.0.0 lib/tw/client/helper.rb
tw-0.5.2 lib/tw/client/helper.rb
tw-0.5.1 lib/tw/client/helper.rb
tw-0.5.0 lib/tw/client/helper.rb