module Listi

Constants

VERSION

Public Class Methods

new(oxford) click to toggle source
# File lib/listi.rb, line 7
def initialize oxford
  @oxford = bool
end

Public Instance Methods

serial_list(input) click to toggle source
# File lib/listi.rb, line 11
def serial_list input
  output = ''
  if input.count >= 1
    input.each { |x|
      if x == input[-1]
        output << "and #{x}."
      else
        unless x == input[-2] && not @oxford
          output << "#{x}, "
        else
          output << "#{x} "
        end
      end
    }
  else
    output << "#{x}."
  end
  return output
end