Class: FlexValidations::NumberedList Private
- Inherits:
-
Object
- Object
- FlexValidations::NumberedList
- Defined in:
- lib/flex_validations.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(items) ⇒ NumberedList
constructor
private
A new instance of NumberedList.
- #to_s ⇒ Object private
Constructor Details
#initialize(items) ⇒ NumberedList
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NumberedList.
47 48 49 |
# File 'lib/flex_validations.rb', line 47 def initialize(items) @items = items end |
Instance Method Details
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/flex_validations.rb', line 51 def to_s listing = @items.map.with_index(1) do |item, n| i = "#{n}. #{item}" if i.end_with?('.') i else "#{i};" end end.join("\n") if listing.end_with?('.') listing elsif listing.end_with?(';') "#{listing[0..-2]}." else "#{listing}." end end |