Sha256: 482e3a46086acf545a05effb5a2f2db50d767cc4f65b14a7c78374359c788a86

Contents?: true

Size: 716 Bytes

Versions: 15

Compression:

Stored size: 716 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]
      @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

15 entries across 15 versions & 1 rubygems

Version Path
tw-1.0.9 lib/tw/client/tweet.rb
tw-1.0.8 lib/tw/client/tweet.rb
tw-1.0.7 lib/tw/client/tweet.rb
tw-1.0.6 lib/tw/client/tweet.rb
tw-1.0.5 lib/tw/client/tweet.rb
tw-1.0.4 lib/tw/client/tweet.rb
tw-1.0.3 lib/tw/client/tweet.rb
tw-1.0.2 lib/tw/client/tweet.rb
tw-1.0.1 lib/tw/client/tweet.rb
tw-1.0.0 lib/tw/client/tweet.rb
tw-0.5.2 lib/tw/client/tweet.rb
tw-0.5.1 lib/tw/client/tweet.rb
tw-0.5.0 lib/tw/client/tweet.rb
tw-0.4.9 lib/tw/client/tweet.rb
tw-0.4.8 lib/tw/client/tweet.rb