Class: UserChoices::ExactLengthConversion

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)


129
130
131
# File 'lib/user-choices/conversions.rb', line 129

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

Instance Method Details

#descriptionObject



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

def description; "of length #{@required_length}"; end

#suitable?(actual) ⇒ Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/user-choices/conversions.rb', line 135

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