lib/chatterbot/utils.rb in chatterbot-1.0.2 vs lib/chatterbot/utils.rb in chatterbot-2.0.0.pre
- old
+ new
@@ -1,10 +1,23 @@
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