Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
trliner opened this Issue · 4 comments

3 participants

@trliner

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.

@jakl
Collaborator

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.

@trliner

I think that ought to do the trick.

@patrickdavey

can this be closed now?

@jakl
Collaborator

Yep, fixed I believe.

@jakl jakl closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.