class FlexValidations::List

@api private

Public Class Methods

new(items) click to toggle source
# File lib/flex_validations.rb, line 20
def initialize(items)
  @items = items
end

Public Instance Methods

to_s() click to toggle source
# File lib/flex_validations.rb, line 24
def to_s
  listing = @items.map do |item|
    i = "- #{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