Class: Twterm::Tab::UserTab
Instance Attribute Summary collapse
Attributes inherited from AbstractTab
#title, #window
Instance Method Summary
collapse
Methods included from Scrollable
#scroller, #total_item_count
Methods included from Publisher
#publish
Methods included from Utils
check_type
Methods included from Dumpable
included
Methods inherited from AbstractTab
#close, #find_or_fetch_list, #find_or_fetch_status, #find_or_fetch_user, #render
Methods included from Subscriber
included, #subscribe, #unsubscribe
Constructor Details
#initialize(app, client, user_id) ⇒ UserTab
Returns a new instance of UserTab.
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/twterm/tab/user_tab.rb', line 32
def initialize(app, client, user_id)
super(app, client)
self.title = 'Loading...'.freeze
@user_id = user_id
find_or_fetch_user(user_id).then do |user|
render
client.lookup_friendships.then { render } unless app.friendship_repository.already_looked_up?(user_id)
self.title = "@#{user.screen_name}"
end
end
|
Instance Attribute Details
#user_id ⇒ Object
Returns the value of attribute user_id.
14
15
16
|
# File 'lib/twterm/tab/user_tab.rb', line 14
def user_id
@user_id
end
|
Instance Method Details
#==(other) ⇒ Object
16
17
18
|
# File 'lib/twterm/tab/user_tab.rb', line 16
def ==(other)
other.is_a?(self.class) && user_id == other.user_id
end
|
#drawable_item_count ⇒ Object
24
25
26
|
# File 'lib/twterm/tab/user_tab.rb', line 24
def drawable_item_count
(window.maxy - 11 - bio_height).div(2)
end
|
#dump ⇒ Object
20
21
22
|
# File 'lib/twterm/tab/user_tab.rb', line 20
def dump
user_id
end
|
#fetch ⇒ Object
28
29
30
|
# File 'lib/twterm/tab/user_tab.rb', line 28
def fetch
render
end
|
#items ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/twterm/tab/user_tab.rb', line 46
def items
items = %i(
open_timeline_tab
show_friends
show_followers
show_likes
manage_lists
)
items << :compose_direct_message unless myself?
items << :open_website unless user.website.nil?
items << :toggle_follow unless myself?
items << :toggle_mute unless myself?
items << :toggle_block unless myself?
items
end
|
#respond_to_key(key) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/twterm/tab/user_tab.rb', line 63
def respond_to_key(key)
return true if scroller.respond_to_key(key)
case key
when 10
perform_selected_action
else
return false
end
true
end
|