class GuidedPath::QuestionTextBoxNode

Attributes

answers[R]
blank[R]
otherwise[R]
text[R]

Public Class Methods

new(args = {}) click to toggle source
Calls superclass method GuidedPath::Node::new
# File lib/guided_path/question_textbox_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_textbox_node.rb, line 20
def to_hash
  output = super
  output[:type] = 'question_text_box'
  output[:answers] = Hash[@answers.collect { |answer,node| [answer, node.label] }]
  output[:text] = @text
  return output
end