Module: TyranoDsl::ParsingWords::AskQuestion
- Includes:
- ParsingWordsModule
- Defined in:
- lib/tyrano_dsl/parsing_words/ask_question.rb
Instance Method Summary collapse
Instance Method Details
#ask_question(possible_answers) ⇒ void
This method returns an undefined value.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tyrano_dsl/parsing_words/ask_question.rb', line 10 def ask_question(possible_answers) symbolized_possible_answers = possible_answers.collect do |possible_answer| unless possible_answer.is_a? Hash raise TyranoDsl::TyranoException, 'Parameter is not a Hash' end symbolized_possible_answer = symbolize_keys(possible_answer) [:text, :left, :top, :scene].each do |param_name| unless symbolized_possible_answer.key? param_name raise TyranoDsl::TyranoException, "Missing value for #{param_name}" end end scene = symbolized_possible_answer[:scene] label = symbolized_possible_answer[:label] context.world.jump_targets << TyranoDsl::Elements::JumpTarget.new(scene, label ? context.world.label_value(label) : nil) symbolized_possible_answer end add_parsed_word( TyranoDsl::Vocabulary::ASK_QUESTION, possible_answers: symbolized_possible_answers ) end |