Sha256: d4d8dd4a4f16ebc8d6681336d9750f8b3ca3c3da0af7845923cb9c2d40179b1a

Contents?: true

Size: 482 Bytes

Versions: 7

Compression:

Stored size: 482 Bytes

Contents

module Chatterbot

  # Assorted handy utility methods
  module Utils

    #
    # return the id of a tweet, or the incoming object (likely already
    # an ID)
    #
    # @param [Tweet] t the Tweet
    def id_from_tweet(t)
      t.is_a?(Twitter::Tweet) ? t.id : t
    end

    #
    # return the id of a User, or the incoming object (likely already
    # an ID)
    #
    # @param [User] u the User
    def id_from_user(u)
      u.is_a?(Twitter::User) ? u.id : u
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chatterbot-2.2.0 lib/chatterbot/utils.rb
chatterbot-2.1.0 lib/chatterbot/utils.rb
chatterbot-2.0.5 lib/chatterbot/utils.rb
chatterbot-2.0.4 lib/chatterbot/utils.rb
chatterbot-2.0.3 lib/chatterbot/utils.rb
chatterbot-2.0.2 lib/chatterbot/utils.rb
chatterbot-2.0.0.pre lib/chatterbot/utils.rb