Class: Twterm::Tab::Preferences::Index
Instance Attribute Summary
Attributes inherited from AbstractTab
#window
Instance Method Summary
collapse
Methods included from Scrollable
#scroller, #total_item_count
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) ⇒ Index
Returns a new instance of Index.
15
16
17
|
# File 'lib/twterm/tab/preferences/index.rb', line 15
def initialize(app, client)
super(app, client)
end
|
Instance Method Details
#drawable_item_count ⇒ Object
19
20
21
|
# File 'lib/twterm/tab/preferences/index.rb', line 19
def drawable_item_count
(window.maxy - 1) / 2
end
|
#image ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/twterm/tab/preferences/index.rb', line 23
def image
drawable_items.map.with_index do |item, i|
curr = scroller.current_index?(i)
cursor = Image.cursor(1, curr)
desc =
case item
when :notification_backend
'Notification backend preferences'
when :photo_viewer_backend
'Photo viewer backend preferences'
end
cursor - Image.whitespace - Image.string(desc).bold(curr)
end
.intersperse(Image.blank_line)
.reduce(Image.empty) { |acc, x| acc | x }
end
|
#items ⇒ Object
41
42
43
44
45
46
|
# File 'lib/twterm/tab/preferences/index.rb', line 41
def items
[
:notification_backend,
:photo_viewer_backend,
]
end
|
#respond_to_key(key) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/twterm/tab/preferences/index.rb', line 48
def respond_to_key(key)
return true if scroller.respond_to_key(key)
case key
when 10
open
else
return false
end
true
end
|
#title ⇒ Object
61
62
63
|
# File 'lib/twterm/tab/preferences/index.rb', line 61
def title
'Preferences'
end
|