Class: UserChoices::LengthConversion
- Inherits:
-
Conversion
- Object
- Conversion
- UserChoices::LengthConversion
- Defined in:
- lib/user-choices/conversions.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#required_length ⇒ Object
readonly
Returns the value of attribute required_length.
Class Method Summary collapse
Instance Method Summary collapse
- #does_length_check? ⇒ Boolean
-
#initialize(conversion_tag) ⇒ LengthConversion
constructor
A new instance of LengthConversion.
- #suitable?(actual) ⇒ Boolean
Methods inherited from Conversion
#convert, #description, for, inherited, is_abstract, record_for
Constructor Details
#initialize(conversion_tag) ⇒ LengthConversion
Returns a new instance of LengthConversion.
111 112 113 114 |
# File 'lib/user-choices/conversions.rb', line 111 def initialize(conversion_tag) super @required_length = conversion_tag[:length] end |
Instance Attribute Details
#required_length ⇒ Object (readonly)
Returns the value of attribute required_length.
110 111 112 |
# File 'lib/user-choices/conversions.rb', line 110 def required_length @required_length end |
Class Method Details
.described_by?(conversion_tag, value_class) ⇒ Boolean
116 117 118 |
# File 'lib/user-choices/conversions.rb', line 116 def self.described_by?(conversion_tag, value_class) conversion_tag.is_a?(Hash) && conversion_tag[:length].is_a?(value_class) end |
Instance Method Details
#does_length_check? ⇒ Boolean
124 |
# File 'lib/user-choices/conversions.rb', line 124 def does_length_check?; true; end |
#suitable?(actual) ⇒ Boolean
120 121 122 |
# File 'lib/user-choices/conversions.rb', line 120 def suitable?(actual) actual.respond_to?(:length) && yield end |