Sha256: b43ac184f522b47dd10a73469ae1d707fa5cf1407d2bf20d4a9c6e032881b8d5

Contents?: true

Size: 421 Bytes

Versions: 16

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true

require "uri"

module Git
  module Lint
    module Validators
      # Validates the format of email addresses.
      class Email
        def initialize text, pattern: URI::MailTo::EMAIL_REGEXP
          @text = text
          @pattern = pattern
        end

        def valid? = String(text).match?(pattern)

        private

        attr_reader :text, :pattern
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
git-lint-4.6.0 lib/git/lint/validators/email.rb
git-lint-4.5.0 lib/git/lint/validators/email.rb
git-lint-4.4.0 lib/git/lint/validators/email.rb
git-lint-4.3.0 lib/git/lint/validators/email.rb
git-lint-4.2.0 lib/git/lint/validators/email.rb
git-lint-4.1.0 lib/git/lint/validators/email.rb
git-lint-4.0.1 lib/git/lint/validators/email.rb
git-lint-4.0.0 lib/git/lint/validators/email.rb
git-lint-3.3.2 lib/git/lint/validators/email.rb
git-lint-3.3.1 lib/git/lint/validators/email.rb
git-lint-3.3.0 lib/git/lint/validators/email.rb
git-lint-3.2.0 lib/git/lint/validators/email.rb
git-lint-3.1.0 lib/git/lint/validators/email.rb
git-lint-3.0.2 lib/git/lint/validators/email.rb
git-lint-3.0.1 lib/git/lint/validators/email.rb
git-lint-3.0.0 lib/git/lint/validators/email.rb