Sha256: c7d137dd62bfd07013f534123948b8b7857b05361a649e397bba4979af19aaf8

Contents?: true

Size: 441 Bytes

Versions: 2

Compression:

Stored size: 441 Bytes

Contents

module VCardio
  module Parser
    #
    # @private
    #
    class NameParser
      def self.call(part)
        group_end_index = part.index('.')
        group_sep_index = group_end_index ? group_end_index + 1 : 0
        line_end_index = (part.index(';') || part.length) - group_sep_index

        name = part[group_sep_index, line_end_index]

        VCardio::Validator::NameValidator.call(name)

        name
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcardio-0.1.1 lib/vcardio/parser/name_parser.rb
vcardio-0.1.0 lib/vcardio/parser/name_parser.rb