Class: AffirmIt::Preference::And
- Inherits:
-
Preference
- Object
- Preference
- AffirmIt::Preference::And
- Defined in:
- lib/affirmit/preference/and.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*preferences) ⇒ And
constructor
A new instance of And.
- #is_preferred?(actual) ⇒ Boolean
Methods inherited from Preference
Constructor Details
#initialize(*preferences) ⇒ And
Returns a new instance of And.
6 7 8 |
# File 'lib/affirmit/preference/and.rb', line 6 def initialize *preferences @preferences = preferences end |
Instance Method Details
#description ⇒ Object
17 18 19 |
# File 'lib/affirmit/preference/and.rb', line 17 def description return @preferences.collect { |preference| preference.description }.join ' and ' end |
#is_preferred?(actual) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/affirmit/preference/and.rb', line 10 def is_preferred? actual @preferences.each do |preference| return false if not preference.is_preferred? actual end return true end |