Module: DInstaller::DBus::Question::Interfaces::Question
- Defined in:
- lib/dinstaller/dbus/question.rb
Overview
Generic interface for a question
Class Method Summary collapse
Instance Method Summary collapse
-
#answer ⇒ String
Answer selected for a client.
-
#answer=(option) ⇒ Object
Selects an option as answer.
- #backend ⇒ DInstaller::Question
-
#default_option ⇒ String
Default option a client should offer as answer.
-
#id ⇒ Integer
Unique id of the question.
-
#options ⇒ Array<String>
Options the question admits as answer.
-
#text ⇒ String
Text of the question.
Class Method Details
.included(base) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/dinstaller/dbus/question.rb', line 93 def self.included(base) base.class_eval do dbus_interface QUESTION_INTERFACE do dbus_reader :id, "u" dbus_reader :text, "s" dbus_reader :options, "as" dbus_reader :default_option, "s" dbus_accessor :answer, "s" end end end |
Instance Method Details
#answer ⇒ String
Answer selected for a client
82 83 84 |
# File 'lib/dinstaller/dbus/question.rb', line 82 def answer backend.answer.to_s end |
#answer=(option) ⇒ Object
Selects an option as answer
89 90 91 |
# File 'lib/dinstaller/dbus/question.rb', line 89 def answer=(option) backend.answer = option.to_sym end |
#backend ⇒ DInstaller::Question
Note:
Classes including this mixin must define a #backend method
|
# File 'lib/dinstaller/dbus/question.rb', line 45
|
#default_option ⇒ String
Default option a client should offer as answer
75 76 77 |
# File 'lib/dinstaller/dbus/question.rb', line 75 def default_option backend.default_option.to_s end |
#id ⇒ Integer
Unique id of the question
52 53 54 |
# File 'lib/dinstaller/dbus/question.rb', line 52 def id backend.id end |
#options ⇒ Array<String>
Note:
Clients are responsible of generating the proper label for each option.
Options the question admits as answer
68 69 70 |
# File 'lib/dinstaller/dbus/question.rb', line 68 def backend..map(&:to_s) end |
#text ⇒ String
Text of the question
59 60 61 |
# File 'lib/dinstaller/dbus/question.rb', line 59 def text backend.text end |