Sha256: 774eb01c0e86fcffb314a6e320f12890e2fce99e853a7c9a92f303f7731521d1

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

module MagicColumns
  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

1 entries across 1 versions & 1 rubygems

Version Path
magick_columns-0.0.1 lib/magick_columns/defaults.rb