class GuidedPath::QuestionMultipleChoiceNode
Attributes
answers[R]
text[R]
Public Class Methods
new(args = {})
click to toggle source
Calls superclass method
GuidedPath::Node::new
# File lib/guided_path/question_multiple_choice_node.rb, line 9 def initialize(args = {}) super args = args.symbolize_keys @answers = args[:answers] raise(ArgumentError, "Must specify answers in an Hash") unless args[:answers] && args[:answers].kind_of?(Hash) @text = args[:text] end
Public Instance Methods
to_hash()
click to toggle source
Calls superclass method
GuidedPath::Node#to_hash
# File lib/guided_path/question_multiple_choice_node.rb, line 19 def to_hash output = super output[:type] = 'question_multiple_choice' output[:answers] = Hash[@answers.collect { |answer,node| [answer, node.label] }] output[:text] = @text return output end