Sha256: bf5221e395f1b521b83ed23b345ca6542b57ee4b6b719e845ff14a1f007b0ecb

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

class Nomen
  module Formatters
    class Full

      def self.format(name)
        String.new.tap do |str|
          if name.first && !name.first.empty?
            str << name.first
          end
          if name.middle && !name.middle.empty?
            str << (str.empty? ? name.middle : " #{name.middle}")
          end
          if name.last && !name.last.empty?
            str << (str.empty? ? name.last : " #{name.last}")
          end
          if name.suffix && !name.suffix.empty?
            str << (str.empty? ? name.suffix : " #{name.suffix}")
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nomen-0.0.2 lib/nomen/formatters/full.rb