Sha256: df483284fa7175bfffcd3c5658b468839439346512bfaafe3f4e82068a918a89

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

module MagickColumns
  DEFAULTS = {
    string: {
      operator: :like,
      mask: '%%%{t}%%',
      condition: ->(t) { t =~ /.+/ },
      convert: ->(t) { t.to_s }
    },
    
    email: {
      operator: :like,
      mask: '%%%{t}%%',
      condition: ->(t) { t =~ /(.+@.*)|(.*@.+)/ },
      convert: ->(t) { t.to_s }
    },

    integer: {
      operator: '=',
      mask: '%{t}',
      condition: ->(t) { t =~ /\A\d+\z/ },
      convert: ->(t) { t.to_i }
    },
    
    date: {
      operator: '=',
      mask: '%{t}',
      condition: ->(t) { ::Timeliness.parse(t.to_s) },
      convert: ->(t) { ::Timeliness.parse(t.to_s) }
    }
  }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magick_columns-0.0.4 lib/magick_columns/defaults.rb
magick_columns-0.0.3 lib/magick_columns/defaults.rb