Class: Flumtter::TimeLine::Base

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/flumtter/app/plugins/timeline/base.rb

Direct Known Subclasses

DeletedTweet, DirectMessage, Event, ReplyTweet, SelfTweet, Tweet

Constant Summary collapse

@@elements =
[]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

#command_value_regexp, #dialog_for_index, #error, #error_handler, #id2obj, #if_tweet, #index_regexp, #index_with_dialog, #logger, #on_event, #parse_index, #parse_time, #sarastire, #sarastire_user, #screen_name_regexp

Constructor Details

#initialize(object, twitter) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
# File 'lib/flumtter/app/plugins/timeline/base.rb', line 12

def initialize(object, twitter)
  @object = object
  @twitter = twitter
  @@elements << object
end

Class Method Details

.[](key) ⇒ Object



8
9
10
# File 'lib/flumtter/app/plugins/timeline/base.rb', line 8

def self.[](key)
  @@elements[key]
end

Instance Method Details

#to_sObject



18
19
20
21
22
23
24
25
26
# File 'lib/flumtter/app/plugins/timeline/base.rb', line 18

def to_s
  text = <<~EOF.color(fg_color)
    #{header}
    #{user}
    #{body}
    #{footer}
  EOF
  bg_color.nil? ? text : text.background_color(bg_color)
end