class FlexValidations::NumberedList
@api private
Public Class Methods
new(items)
click to toggle source
# File lib/flex_validations.rb, line 47 def initialize(items) @items = items end
Public Instance Methods
to_s()
click to toggle source
# 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