Class: Playmo::Answer
Instance Attribute Summary collapse
-
#answer ⇒ Object
Returns the value of attribute answer.
-
#block ⇒ Object
Returns the value of attribute block.
-
#color ⇒ Object
Returns the value of attribute color.
-
#num ⇒ Object
Returns the value of attribute num.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #default? ⇒ Boolean
-
#initialize(answer, options, num, &block) ⇒ Answer
constructor
A new instance of Answer.
- #render ⇒ Object (also: #to_s)
Constructor Details
#initialize(answer, options, num, &block) ⇒ Answer
Returns a new instance of Answer.
5 6 7 8 9 10 11 |
# File 'lib/playmo/answer.rb', line 5 def initialize(answer, , num, &block) @answer = answer @options = @num = num @block = block @color = Thor::Shell::Color.new end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer.
3 4 5 |
# File 'lib/playmo/answer.rb', line 3 def answer @answer end |
#block ⇒ Object
Returns the value of attribute block.
3 4 5 |
# File 'lib/playmo/answer.rb', line 3 def block @block end |
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'lib/playmo/answer.rb', line 3 def color @color end |
#num ⇒ Object
Returns the value of attribute num.
3 4 5 |
# File 'lib/playmo/answer.rb', line 3 def num @num end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/playmo/answer.rb', line 3 def @options end |
Instance Method Details
#default? ⇒ Boolean
13 14 15 |
# File 'lib/playmo/answer.rb', line 13 def default? .try(:[], :default) == true end |
#render ⇒ Object Also known as: to_s
17 18 19 20 21 22 23 |
# File 'lib/playmo/answer.rb', line 17 def render if @answer result = color.set_color("#{@num}. #{@answer}", :white, true) result << " (default)" if default? result end end |