Sha256: a7a3c77e474f76f062857a2062f234b862a4132dc609b04e5a17d81d1d85d00b

Contents?: true

Size: 557 Bytes

Versions: 18

Compression:

Stored size: 557 Bytes

Contents

module Tw
  class Tweet
    attr_reader :id, :user, :text, :time

    def initialize(opts)
      @id = opts[:id]
      @user = opts[:user]
      @text = opts[:text]
      @time = opts[:time]
    end

    def to_json(*a)
      {
        :id => @id,
        :user => @user,
        :text => @text,
        :time => @time
      }.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

18 entries across 18 versions & 1 rubygems

Version Path
tw-0.4.7 lib/tw/client/tweet.rb
tw-0.4.6 lib/tw/client/tweet.rb
tw-0.4.5 lib/tw/client/tweet.rb
tw-0.4.4 lib/tw/client/tweet.rb
tw-0.4.3 lib/tw/client/tweet.rb
tw-0.4.2 lib/tw/client/tweet.rb
tw-0.4.1 lib/tw/client/tweet.rb
tw-0.4.0 lib/tw/client/tweet.rb
tw-0.3.9 lib/tw/client/tweet.rb
tw-0.3.8 lib/tw/client/tweet.rb
tw-0.3.7 lib/tw/client/tweet.rb
tw-0.3.6 lib/tw/client/tweet.rb
tw-0.3.5 lib/tw/client/tweet.rb
tw-0.3.4 lib/tw/client/tweet.rb
tw-0.3.3 lib/tw/client/tweet.rb
tw-0.3.2 lib/tw/client/tweet.rb
tw-0.3.1 lib/tw/client/tweet.rb
tw-0.3.0 lib/tw/client/tweet.rb