Class: UserChoices::RangeLengthConversion

Inherits:
LengthConversion show all
Defined in:
lib/user-choices/conversions.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from LengthConversion

#required_length

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LengthConversion

#does_length_check?, #initialize

Methods inherited from Conversion

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

Constructor Details

This class inherits a constructor from UserChoices::LengthConversion

Class Method Details

.described_by?(conversion_tag) ⇒ Boolean

Returns:

  • (Boolean)


141
142
143
# File 'lib/user-choices/conversions.rb', line 141

def self.described_by?(conversion_tag)
  super(conversion_tag, Range)
end

Instance Method Details

#descriptionObject



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

def description; "a list whose length is in this range: #{@required_length}"; end

#suitable?(actual) ⇒ Boolean

Returns:

  • (Boolean)


147
148
149
# File 'lib/user-choices/conversions.rb', line 147

def suitable?(actual)
  super(actual) { @required_length.include?(actual.length) }
end