Sha256: 4beae4424423a217640faacc33a21e0e892cbfbb2e942b5d45c83534463f4eaa

Contents?: true

Size: 354 Bytes

Versions: 6

Compression:

Stored size: 354 Bytes

Contents

module Rasti
  module Types
    class Regexp
      class << self

        include Castable

        private

        def valid?(value)
          value.is_a?(::Regexp) || value.is_a?(::String)
        end

        def transform(value)
          value.is_a?(::Regexp) ? value.source : ::Regexp.compile(value).source
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rasti-types-2.0.1 lib/rasti/types/regexp.rb
rasti-types-2.0.0 lib/rasti/types/regexp.rb
rasti-types-1.1.2 lib/rasti/types/regexp.rb
rasti-types-1.1.1 lib/rasti/types/regexp.rb
rasti-types-1.1.0 lib/rasti/types/regexp.rb
rasti-types-1.0.0 lib/rasti/types/regexp.rb