Sha256: bd1c7e89509b505d4dae7b2d15cb4cda5e839b558ea5b56c26239d79726f6fa9

Contents?: true

Size: 401 Bytes

Versions: 4

Compression:

Stored size: 401 Bytes

Contents

module Rasti
  class Form
    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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasti-form-3.1.2 lib/rasti/form/types/regexp.rb
rasti-form-3.1.1 lib/rasti/form/types/regexp.rb
rasti-form-3.1.0 lib/rasti/form/types/regexp.rb
rasti-form-3.0.0 lib/rasti/form/types/regexp.rb