class Tw::Tweet

Attributes

fav_count[R]
id[R]
rt_count[R]
text[R]
time[R]
user[R]

Public Class Methods

new(opts) click to toggle source
# File lib/tw/client/tweet.rb, line 5
def initialize(opts)
  @id = opts[:id]
  @user = opts[:user]
  @text = opts[:text]
  @time = opts[:time].getlocal
  @fav_count = opts[:fav_count]
  @rt_count = opts[:rt_count]
end

Public Instance Methods

format(fmt) click to toggle source
# File lib/tw/client/tweet.rb, line 33
def format(fmt)
  self.instance_eval "\"#{fmt}\""
end
to_json(*a) click to toggle source
# File lib/tw/client/tweet.rb, line 14
def to_json(*a)
  {
    :id => @id,
    :user => @user,
    :text => @text,
    :time => @time,
    :fav_count => @fav_count,
    :rt_count => @rt_count
  }.to_json(*a)
end
to_s() click to toggle source
# File lib/tw/client/tweet.rb, line 29
def to_s
  "@#{user} #{text} - #{time} #{url}"
end
url() click to toggle source
# File lib/tw/client/tweet.rb, line 25
def url
  "https://twitter.com/#{user}/status/#{id}"
end