Class: Rasam::RationalChoice
- Inherits:
-
Object
- Object
- Rasam::RationalChoice
- Defined in:
- lib/rasam.rb
Overview
Value Object
-
Pair - Consists of two options
-
Choice - Selected option from a given pair
-
Criteria - Rationale for the preference. Why the choice was made?
Instance Attribute Summary collapse
-
#choice ⇒ Object
readonly
Returns the value of attribute choice.
-
#criteria ⇒ Object
readonly
Returns the value of attribute criteria.
-
#pair ⇒ Object
readonly
Returns the value of attribute pair.
Instance Method Summary collapse
-
#initialize(pair, choice, criteria) ⇒ RationalChoice
constructor
A new instance of RationalChoice.
- #to_s ⇒ Object
Constructor Details
#initialize(pair, choice, criteria) ⇒ RationalChoice
Returns a new instance of RationalChoice.
11 12 13 14 15 |
# File 'lib/rasam.rb', line 11 def initialize(pair, choice, criteria) @choice = choice @criteria = criteria @pair = pair end |
Instance Attribute Details
#choice ⇒ Object (readonly)
Returns the value of attribute choice.
9 10 11 |
# File 'lib/rasam.rb', line 9 def choice @choice end |
#criteria ⇒ Object (readonly)
Returns the value of attribute criteria.
9 10 11 |
# File 'lib/rasam.rb', line 9 def criteria @criteria end |
#pair ⇒ Object (readonly)
Returns the value of attribute pair.
9 10 11 |
# File 'lib/rasam.rb', line 9 def pair @pair end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/rasam.rb', line 17 def to_s "You selected #{@choice} because of #{@criteria} for #{@pair}" end |