class Flumtter::TimeLine::Base

Public Class Methods

[](key) click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 8
def self.[](key)
  @@elements[key]
end
new(object, twitter) click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 12
def initialize(object, twitter)
  @object = object
  @twitter = twitter
  @@elements << object
end

Public Instance Methods

to_s() click to toggle source
# 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

Private Instance Methods

bg_color() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 46
def bg_color
  case color
  when Symbol
    nil
  when Array
    color[1]
  end
end
body() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 67
def body
  @object.text.nl
end
color() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 33
def color
  :white
end
created_at() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 55
def created_at
  parse_time(@object.created_at)
end
fg_color() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 37
def fg_color
  case color
  when Symbol
    color
  when Array
    color[0]
  end
end
header() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 63
def header
  "#{index} ".ljust(Terminal.x, ?-)
end
index() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 59
def index
  @@elements.rindex(@object)
end
user() click to toggle source
# File lib/flumtter/app/plugins/timeline/base.rb, line 29
def user
  "#{@object.user.name} (@#{@object.user.screen_name})"
end