Method: Redwood::HorizontalSelector#line
- Defined in:
- lib/sup/horizontal_selector.rb
#line(width = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sup/horizontal_selector.rb', line 29 def line width=nil label = if width sprintf "%#{width}s ", @label else "#{@label} " end [[@base_color, label]] + (0 ... @labels.length).inject([]) do |array, i| array + [ if i == @selection [@selected_color, @labels[i]] else [@base_color, @labels[i]] end] + [[@base_color, " "]] end + [[@base_color, ""]] end |