cowtech-extensions 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,7 +48,7 @@ module Cowtech
48
48
  day = 18
49
49
  end
50
50
  # End
51
-
51
+
52
52
  Date.civil(year, month, day)
53
53
  end
54
54
 
@@ -72,9 +72,20 @@ module Cowtech
72
72
  }
73
73
  end
74
74
 
75
- def custom_format(key = "date")
76
- key = "ct_#{key}" if key !~ /^ct_/
77
- self.custom_formats.fetch(key.to_sym, "%d/%m/%Y")
75
+ def custom_format(key)
76
+ self.custom_formats.fetch(key.to_sym, key)
77
+ end
78
+
79
+ def is_valid?(value, format = "%F %T")
80
+ rv = true
81
+
82
+ begin
83
+ DateTime.strptime(value, format)
84
+ rescue
85
+ rv = false
86
+ end
87
+
88
+ rv
78
89
  end
79
90
  end
80
91
 
@@ -114,7 +125,7 @@ module Cowtech
114
125
  mrv
115
126
  end
116
127
 
117
- self.strftime(localized_format)
128
+ self.to_formatted_s(localized_format)
118
129
  end
119
130
 
120
131
  def to_localized_s(format = nil)
@@ -11,7 +11,7 @@ module Cowtech
11
11
  module Version
12
12
  MAJOR = 1
13
13
  MINOR = 6
14
- PATCH = 0
14
+ PATCH = 1
15
15
 
16
16
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
17
17
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cowtech-extensions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 0
10
- version: 1.6.0
9
+ - 1
10
+ version: 1.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shogun