Sha256: c825bdb8d80137c8a1224708bcc3233910dcccf079e1a54788ca9ae6255cf9bc

Contents?: true

Size: 407 Bytes

Versions: 2

Compression:

Stored size: 407 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|
      puts 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-0.3.7 lib/tw/client/helper.rb
tw-0.3.6 lib/tw/client/helper.rb