Class: Twterm::Tab::Preferences::Control
Instance Method Summary
collapse
Methods included from Publisher
#publish
Methods included from Utils
check_type
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, #initialize, #render
Methods included from Subscriber
included, #subscribe, #unsubscribe
Instance Method Details
#drawable_item_count ⇒ Object
14
15
16
|
# File 'lib/twterm/tab/preferences/control.rb', line 14
def drawable_item_count
1
end
|
#image ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/twterm/tab/preferences/control.rb', line 18
def image
drawable_items.map.with_index do |item, i|
curr = scroller.current_index?(i)
cursor = Image.cursor(2, curr)
options = Image.toggle_switch(['traditional', 'natural'], app.preferences[:control, item])
desc =
case item
when :scroll_direction
= Image.string('Scroll direction')
body = Image.string(' ') - options
cursor - Image.whitespace - ( | body)
end
end
.intersperse(Image.blank_line)
.reduce(Image.empty) { |acc, x| acc | x }
end
|
#items ⇒ Object
35
36
37
38
39
|
# File 'lib/twterm/tab/preferences/control.rb', line 35
def items
[
:scroll_direction,
]
end
|
#respond_to_key(key) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/twterm/tab/preferences/control.rb', line 41
def respond_to_key(key)
return true if scroller.respond_to_key(key)
case key
when 10
perform_selected_action
end
false
end
|
#title ⇒ Object
52
53
54
|
# File 'lib/twterm/tab/preferences/control.rb', line 52
def title
'Control preferences'
end
|