Class: Palaver::ListWithOptions
- Inherits:
-
Base
- Object
- Base
- Palaver::ListWithOptions
show all
- Defined in:
- lib/palaver/list_with_options.rb
Defined Under Namespace
Classes: Option
Instance Method Summary
collapse
Methods inherited from Base
#height, #text, #width, #with_tempfile
Constructor Details
Returns a new instance of ListWithOptions.
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/palaver/list_with_options.rb', line 17
def initialize(options)
super(options)
@dialog_options = []
@list_height = 0
options.each do |option,value|
case option
when :options then @dialog_options = value.map { |o| Option.new(o[0],o[1],o[2]) }
end
end
end
|
Instance Method Details
#list_height(h) ⇒ Object
33
34
35
|
# File 'lib/palaver/list_with_options.rb', line 33
def list_height(h)
@list_height = h
end
|
#option(tag, desc, status = nil) ⇒ Object
29
30
31
|
# File 'lib/palaver/list_with_options.rb', line 29
def option(tag, desc, status=nil)
@dialog_options.push Option.new(tag,desc,status)
end
|
#options_string_no_status ⇒ Object
41
42
43
|
# File 'lib/palaver/list_with_options.rb', line 41
def options_string_no_status
@dialog_options.map { |o| "'#{o.tag}' '#{o.item}'" }.join ' '
end
|
#options_string_with_status ⇒ Object
37
38
39
|
# File 'lib/palaver/list_with_options.rb', line 37
def options_string_with_status
@dialog_options.map { |o| "'#{o.tag}' '#{o.item}' '#{o.status == :on ? 'on' : 'off'}'" }.join ' '
end
|