Sha256: 90e2c8980478dfc89d1ee783cbb4a6d609b8828b275aa1041e1c6d9db610770d
Contents?: true
Size: 725 Bytes
Versions: 2
Compression:
Stored size: 725 Bytes
Contents
module Tw class Tweet attr_reader :id, :user, :text, :time, :fav_count, :rt_count 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 def to_json(*a) { :id => @id, :user => @user, :text => @text, :time => @time, :fav_count => @fav_count, :rt_count => @rt_count }.to_json(*a) end def url "http://twitter.com/#{user}/status/#{id}" end def to_s "@#{user} #{text} - #{time} #{url}" end def format(fmt) self.instance_eval "\"#{fmt}\"" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tw-1.0.11 | lib/tw/client/tweet.rb |
tw-1.0.10 | lib/tw/client/tweet.rb |