Class: Twterm::Tab::New::User
Instance Method Summary
collapse
Methods included from Publisher
#publish
Methods included from Utils
check_type
Methods inherited from AbstractTab
#close, #find_or_fetch_list, #find_or_fetch_status, #find_or_fetch_user, #initialize, #render
Methods included from Subscriber
included, #subscribe, #unsubscribe
Instance Method Details
#==(other) ⇒ Object
13
14
15
|
# File 'lib/twterm/tab/new/user.rb', line 13
def ==(other)
other.is_a?(self.class)
end
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/twterm/tab/new/user.rb', line 17
def invoke_input
resetter = proc do
Curses.reset_prog_mode
sleep 0.1
publish(Event::Screen::Refresh.new)
end
app.completion_manager.set_screen_name_mode!
input_thread = Thread.new do
Curses.close_screen
puts "\nSearch user"
screen_name = (readline('> @', true) || '').strip
resetter.call
if screen_name.nil? || screen_name.empty?
app.tab_manager.switch(Tab::New::Index.new(app, client))
else
client.show_user(screen_name).then do |user|
if user.nil?
publish(Event::Message::Error.new('User not found'))
tab = Tab::New::Index.new(app, client)
else
tab = Tab::UserTab.new(app, client, user.id)
end
app.tab_manager.switch(tab)
end
end
end
app.register_interruption_handler do
input_thread.kill
resetter.call
tab = Tab::New::Index.new(app, client)
app.tab_manager.switch(tab)
end
input_thread.join
end
|
#respond_to_key(_) ⇒ Object
57
58
59
|
# File 'lib/twterm/tab/new/user.rb', line 57
def respond_to_key(_)
false
end
|
#title ⇒ Object
61
62
63
|
# File 'lib/twterm/tab/new/user.rb', line 61
def title
'New tab'.freeze
end
|