Class: AffirmIt::Preference::Preference

Inherits:
Object
  • Object
show all
Defined in:
lib/affirmit/preference/preference.rb,
lib/affirmit/preferences.rb

Overview

A Preference is a condition that can be preferred by an affirmation. The code being affirmed may choose to prefer the same opinion or not. If the two opinions differ, the facilitator will make note of the differing opinion with the description returned by this preference.

Direct Known Subclasses

And, Between, GreaterThan, Includes, Is, IsA, LessThan, Matches, Not, Or, RespondsTo, SameAs

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Object



94
95
96
# File 'lib/affirmit/preferences.rb', line 94

def & other
  return And.new self, other
end

#descriptionObject

If #is_preferred? returns false, this method will be called in order to generate a description of this preference, in an overall description like:

“preferred description, but was <actual>”



24
25
26
# File 'lib/affirmit/preference/preference.rb', line 24

def description
  return ''
end

#is_preferred?(actual) ⇒ Boolean

Determines whether the actual value agrees with this preference.

Returns:

  • (Boolean)


14
15
16
# File 'lib/affirmit/preference/preference.rb', line 14

def is_preferred? actual
  return true
end

#|(other) ⇒ Object



98
99
100
# File 'lib/affirmit/preferences.rb', line 98

def | other
  return Or.new self, other
end

#~Object



102
103
104
# File 'lib/affirmit/preferences.rb', line 102

def ~
  return Not.new self
end