Class: Rasam::RationalChoice

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#choiceObject (readonly)

Returns the value of attribute choice.



9
10
11
# File 'lib/rasam.rb', line 9

def choice
  @choice
end

#criteriaObject (readonly)

Returns the value of attribute criteria.



9
10
11
# File 'lib/rasam.rb', line 9

def criteria
  @criteria
end

#pairObject (readonly)

Returns the value of attribute pair.



9
10
11
# File 'lib/rasam.rb', line 9

def pair
  @pair
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/rasam.rb', line 17

def to_s
  "You selected #{@choice} because of #{@criteria} for #{@pair}"
end