Sha256: 9830af5ff85e50406cdd91cca123d88f6ba9e65998801bd84d4c2930874f7da1

Contents?: true

Size: 1.3 KB

Versions: 39

Compression:

Stored size: 1.3 KB

Contents

module Format
  # yes this is valid ruby, even if textmate's highlighter can't grok it
  DOMAIN = /^([a-z0-9]([-a-z0-9]*[a-z0-9])?\.)+((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)|(c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]|(g[abdefghilmnpqrstuwy]|gov)|(h[kmnrtu]#{RAILS_ENV=='test'?'|host':''})|(i[delmnoqrst]|info|int)|(j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]|(m[acdghklmnopqrstuvwxyz]|mil|mobi|museum)|(n[acefgilopruz]|name|net)|(om|org)|(p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]|(t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw])$/ unless const_defined?(:DOMAIN)
  STRING = /^[a-z0-9-]+$/
  #EMAIL  = /(\A(\s*)\Z)|(\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z)/i

  CVV_REGEX = Regexp.new(/^[0-9]{3,4}$/).freeze
  PHONE_REGEX = Regexp.new(/\d|-|\.|\s|\)|\(/).freeze
  MONEY_REGEX = Regexp.new(/^[0-9]{1,4}\.[0-9]{2}$/).freeze
  EMAIL_REGEX = Regexp.new(/^([a-zA-Z0-9&_?\/`!|#*$^%=~{}+'-]+|"([\x00-\x0C\x0E-\x21\x23-\x5B\x5D-\x7F]|\\[\x00-\x7F])*")(\.([a-zA-Z0-9&_?\/`!|#*$^%=~{}+'-]+|"([\x00-x0C\x0E-\x21\x23-\x5B\x5D-\x7F]|\\[\x00-\x7F])*"))*@([a-zA-Z0-9&_?\/`!|#*$^%=~{}+'-]+|\[([\x00-\x0C\x0E-\x5A\x5E-\x7F]|\\[\x00-\x7F])*\])(\.([a-zA-Z0-9&_?\/`!|#*$^%=~{}+'-]+|\[([\x00-\x0C\x0E-\x5A\x5E-\x7F]|\\[\x00-\x7F])*\]))*$/).freeze

end

Version data entries

39 entries across 39 versions & 4 rubygems

Version Path
kdmny-spree-0.0.1 lib/format.rb
spree-0.11.4 lib/format.rb
spree-0.11.3 lib/format.rb
spree-0.11.2 lib/format.rb
spree-0.11.1 lib/format.rb
spree-0.11.0 lib/format.rb
spree-0.10.2 lib/format.rb
spree-0.10.1 lib/format.rb
spree-0.10.0 lib/format.rb
spree-0.10.0.beta lib/format.rb
spree-enriquez-0.9.4 lib/format.rb
spree-0.9.4 lib/format.rb
spree-0.9.3 lib/format.rb
spree-0.9.2 lib/format.rb
spree-0.9.1 lib/format.rb
spree-0.9.0 lib/format.rb
spree-0.8.4 lib/format.rb
spree-0.8.5 lib/format.rb
railscart-0.0.1 starter-app/vendor/plugins/railscart/lib/format.rb
railscart-0.0.2 starter_app/vendor/plugins/railscart/lib/format.rb