sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.58k stars 1.31k forks source link

Marshal dump fail on NullObject #892

Closed nanaya closed 1 year ago

nanaya commented 6 years ago

IIUC, this error:

irb(main):001:0> Marshal.dump(Twitter::NullObject.new)
RuntimeError: Twitter::NullObject#marshal_dump returned same class instance
        from (irb):1:in `dump'
        from (irb):1

Causes this to fail (replace keys accordingly)

require 'twitter'

client = Twitter::REST::Client.new do |config|
  config.consumer_key = "CONSUMER_KEY"
  config.consumer_secret = "CONSUMER_SECRET"
end

timeline = client.user_timeline('edogawa_test').select do |tweet|
  tweet.retweeted_status.nil? || tweet.user.id != tweet.retweeted_status.user.id
end

Marshal.dump(timeline)

Am I doing something wrong here or there is a bug somewhere? NullObject missing #marshal_dump, perhaps?

Looks like enabling black_hole causes #marshal_dump to return itself (and thus failing dump).

nanaya commented 6 years ago

Also opened avdi/naught#72.