Class: UserChoices::ChoiceCheckingConversion

Inherits:
Conversion
  • Object
show all
Defined in:
lib/user-choices/conversions.rb

Overview

Note: since some of the above classes are described_by? methods that respond_to :include, this class should be last, so that it’s checked last.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Conversion

#convert, #does_length_check?, for, inherited, #initialize, is_abstract, record_for

Constructor Details

This class inherits a constructor from UserChoices::Conversion

Class Method Details

.described_by?(conversion_tag) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


156
157
158
# File 'lib/user-choices/conversions.rb', line 156

def self.described_by?(conversion_tag)
  conversion_tag.respond_to?(:include?)
end

Instance Method Details

#descriptionObject



161
# File 'lib/user-choices/conversions.rb', line 161

def description; "one of #{friendly_list('or', @conversion_tag)}"; end

#suitable?(actual) ⇒ Boolean

Returns:

  • (Boolean)


160
# File 'lib/user-choices/conversions.rb', line 160

def suitable?(actual); @conversion_tag.include?(actual); end