Sha256: 1e947cd047d27b2ccfb7b626999a972ac37c515d7872b3ad558f1400d3c6bd69

Contents?: true

Size: 490 Bytes

Versions: 3

Compression:

Stored size: 490 Bytes

Contents

module Aggro
  module Transform
    # Private: Transforms integer representations.
    module Email
      EMAIL_REGEX = %r{
        \A([-a-z0-9!\#$%&'*+/=?^_`{|}~]+\.)*
        [-a-z0-9!\#$%&'*+/=?^_`{|}~]+
        @
        ((?:[-a-z0-9]+\.)+
        [a-z]{2,})\Z
      }xi

      module_function

      def deserialize(value)
        value = value.to_s

        value if value.match(EMAIL_REGEX)
      end

      def serialize(value)
        deserialize value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aggro-0.0.4 lib/aggro/transform/email.rb
aggro-0.0.3 lib/aggro/transform/email.rb
aggro-0.0.2 lib/aggro/transform/email.rb