Class: Gamefic::Props::YesOrNo

Inherits:
MultipleChoice show all
Defined in:
lib/gamefic/props/yes_or_no.rb

Overview

A MultipleChoice variant that only allows Yes or No.

Instance Attribute Summary

Attributes inherited from MultipleChoice

#invalid_message

Attributes inherited from Default

#context, #input, #prompt, #scene

Instance Method Summary collapse

Methods inherited from MultipleChoice

#index, #number, #selection

Methods inherited from Default

#initialize, #output

Constructor Details

This class inherits a constructor from Gamefic::Props::Default

Instance Method Details

#no?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/gamefic/props/yes_or_no.rb', line 12

def no?
  selection == 'No'
end

#optionsObject



16
17
18
# File 'lib/gamefic/props/yes_or_no.rb', line 16

def options
  @options ||= %w[Yes No].freeze
end

#yes?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/gamefic/props/yes_or_no.rb', line 8

def yes?
  selection == 'Yes'
end