Class: Retrobot::Tweet
- Inherits:
-
Object
- Object
- Retrobot::Tweet
- Defined in:
- lib/retrobot/tweet.rb
Instance Attribute Summary collapse
-
#expanded_urls ⇒ Object
Returns the value of attribute expanded_urls.
-
#in_reply_to_status_id ⇒ Object
Returns the value of attribute in_reply_to_status_id.
-
#in_reply_to_user_id ⇒ Object
Returns the value of attribute in_reply_to_user_id.
-
#retweeted_status_id ⇒ Object
Returns the value of attribute retweeted_status_id.
-
#retweeted_status_timestamp ⇒ Object
Returns the value of attribute retweeted_status_timestamp.
-
#retweeted_status_user_id ⇒ Object
Returns the value of attribute retweeted_status_user_id.
-
#source ⇒ Object
Returns the value of attribute source.
-
#text ⇒ Object
Returns the value of attribute text.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#tweet_id ⇒ Object
Returns the value of attribute tweet_id.
Class Method Summary collapse
Instance Attribute Details
#expanded_urls ⇒ Object
Returns the value of attribute expanded_urls.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def end |
#in_reply_to_status_id ⇒ Object
Returns the value of attribute in_reply_to_status_id.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def in_reply_to_status_id @in_reply_to_status_id end |
#in_reply_to_user_id ⇒ Object
Returns the value of attribute in_reply_to_user_id.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def in_reply_to_user_id @in_reply_to_user_id end |
#retweeted_status_id ⇒ Object
Returns the value of attribute retweeted_status_id.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def retweeted_status_id @retweeted_status_id end |
#retweeted_status_timestamp ⇒ Object
Returns the value of attribute retweeted_status_timestamp.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def end |
#retweeted_status_user_id ⇒ Object
Returns the value of attribute retweeted_status_user_id.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def retweeted_status_user_id @retweeted_status_user_id end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def source @source end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def text @text end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def end |
#tweet_id ⇒ Object
Returns the value of attribute tweet_id.
5 6 7 |
# File 'lib/retrobot/tweet.rb', line 5 def tweet_id @tweet_id end |
Class Method Details
.parse_line(cols) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/retrobot/tweet.rb', line 8 def self.parse_line(cols) t = self.new t.tweet_id = str_to_int_or_nil(cols[0]) t.in_reply_to_status_id = str_to_int_or_nil(cols[1]) t.in_reply_to_user_id = str_to_int_or_nil(cols[2]) t. = cols[3] t.source = cols[4] t.text = cols[5] t.retweeted_status_id = str_to_int_or_nil(cols[6]) t.retweeted_status_user_id = str_to_int_or_nil(cols[7]) t. = str_to_time_or_nil(cols[8]) t. = cols[9..-1] t end |
.str_to_int_or_nil(str) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/retrobot/tweet.rb', line 23 def self.str_to_int_or_nil(str) if str.nil? || str.empty? nil else str.to_i end end |
.str_to_time_or_nil(str) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/retrobot/tweet.rb', line 31 def self.str_to_time_or_nil(str) if str.nil? || str.empty? nil else Time.parse(str).localtime end end |