Autolinking a Tweet object from twitter gem v5.2.0 raises an error #101

Closed
trliner opened this Issue Dec 13, 2013 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

trliner commented Dec 13, 2013

The auto_link method raises a RuntimeError when passed the text of a Twitter::Tweet object from the latest version (5.2.0) of the twitter gem.

Here's an example:

require 'twitter' # 5.2.0
require 'twitter-text' # 1.7.0

client = Twitter::REST::Client.new do |config|
  config.consumer_key        = "YOUR_CONSUMER_KEY"
  config.consumer_secret     = "YOUR_CONSUMER_SECRET"
  config.access_token        = "YOUR_ACCESS_TOKEN"
  config.access_token_secret = "YOUR_ACCESS_SECRET"
end

tweet = client.user_timeline('gem').first

Twitter::Autolink.auto_link(tweet.text)
# => RuntimeError: can't modify frozen String

This was working as expected in version 4.8.1, but I haven't tested any of the versions in between.

Contributor

jakl commented Dec 14, 2013

Nice catch. Sounds like a quickfix would be tweet.text.dup to unfreeze it first. Pull requests are appreciated, probably add dup as the first action of the method (and maybe other places). Otherwise I'll fix it as I go through my tasks.

Contributor

trliner commented Dec 14, 2013

I think that ought to do the trick.

can this be closed now?

Contributor

jakl commented Oct 14, 2014

Yep, fixed I believe.

jakl closed this Oct 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment