cowtech-rails 1.1.2.0 → 1.2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,56 @@ module Cowtech
24
24
  custom_respond_with(rv.to_json)
25
25
  end
26
26
  end
27
+
28
+ def valid_email?(field)
29
+ /^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i.match(field.to_s) != nil
30
+ end
31
+
32
+ def valid_phone?(field)
33
+ /^(((\+|00)\d{1,4}\s?)?(\d{0,4}\s?)?(\d{5,}))?$/i.match(field.to_s) != nil
34
+ end
35
+
36
+ def valid_letter?(field)
37
+ /^([a-z])$/i.match(field.to_s) != nil
38
+ end
39
+
40
+ def valid_number?(field)
41
+ field.to_s.is_valid_float?
42
+ end
43
+
44
+ def valid_date?(field)
45
+ begin
46
+ DateTime.strptime(field.to_s, "%d/%m/%Y")
47
+ true
48
+ rescue ArgumentError
49
+ false
50
+ end
51
+ end
52
+
53
+ def valid_time?(field)
54
+ begin
55
+ DateTime.strptime(field.to_s, "%H:%M")
56
+ true
57
+ rescue ArgumentError
58
+ false
59
+ end
60
+ end
61
+
62
+ def valid_piva?(field)
63
+ /^([0-9A-Z]{11,17})$/i.match(field.to_s) != nil
64
+ end
65
+
66
+ def valid_cf?(field)
67
+ /^([0-9A-Z]{16})$/i.match(field.to_s) != nil
68
+ end
69
+
70
+ def valid_cap?(field)
71
+ /^([0-9]{5})$/i.match(field.to_s) != nil
72
+ end
73
+
74
+ def valid_password?(field)
75
+ field.to_s.length >= 8
76
+ end
27
77
  end
28
78
  end
29
79
  end
@@ -8,8 +8,8 @@ module Cowtech
8
8
  module Rails
9
9
  module Version
10
10
  MAJOR = 1
11
- MINOR = 1
12
- PATCH = 2
11
+ MINOR = 2
12
+ PATCH = 0
13
13
  BUILD = 0
14
14
 
15
15
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -4,10 +4,10 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
8
7
  - 2
9
8
  - 0
10
- version: 1.1.2.0
9
+ - 0
10
+ version: 1.2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shogun
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-06 00:00:00 +02:00
18
+ date: 2011-04-08 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21