class Gamefic::Props::MultipleChoice
Props for MultipleChoice scenes.
def index
-
(Integer, nil)
-
def index return nil unless input @index ||= index_by_number || index_by_text end
def index_by_number
def index_by_number return input.to_i - 1 if input.match(/^\d+$/) && options[input.to_i - 1] nil end
def index_by_text
def index_by_text options.find_index { |opt| opt.casecmp?(input) } end
def invalid_message
def invalid_message @invalid_message ||= '"%<input>s" is not a valid choice.' end
def number
-
(Integer, nil)
-
def number return nil unless index index + 1 end
def options
-
(Array
-)
def options @options ||= [] end
def selected?
def selected? !!index end
def selection
-
(String, nil)
-
def selection return nil unless index options[index] end