evnt 3.1.1 → 3.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04e50930d63c06bea3e9210c6e509a570994198cd4dd2c5f966d3701720587e0
4
- data.tar.gz: bff08e10f4ae1c9379ec1256d4302b2a3230e8a72d4809b7c1df789b2c7f8695
3
+ metadata.gz: b47e9514c1003fc6c670c61af7b5d19974e479e27282ce09328abb2738fa7508
4
+ data.tar.gz: 9e47da764eb7806cb411c120332280b4bd8bf5a6d0ff4bd8f16f0dabfe9e5be2
5
5
  SHA512:
6
- metadata.gz: 3cc055a1e3886e9603395ea779589d410194c7e14585d9ad6ce586a7ebad9b1b3474feebaf8b58e475e431b22f5d6ca306154dab76c0d5b60fd8ab40e251a37b
7
- data.tar.gz: a597ef9f651a5f2d8ce358264f4a0faa42f866653e7eda72fb5c5a2cbdca2691bc84080bda10d1b586f9710a2b3ab77173af18230c92309b0e13ea34569f9b4e
6
+ metadata.gz: f318bbaace2c47ede9c46efbdf87c5cbe85a67c021ddec28db6a879c458770c2e2cde0cb47c66bfae2351408aa49aad4040e860bd31374bfe5384b339120f870
7
+ data.tar.gz: a3275d02c0ed51b194c04452f654bca1202b7f47dde5f2bd707b35d096c229c6246e283f492bac3b5896ca6c9ff4173b6f361cd338f5765c23cdd54f9caa3291
@@ -141,7 +141,7 @@ module Evnt
141
141
  if validator.passed?
142
142
  @params[val[:param]] = validator.value
143
143
  else
144
- err "#{val[:param].capitalize} value not accepted"
144
+ err val[:options][:err] || "#{val[:param].capitalize} value not accepted"
145
145
  break
146
146
  end
147
147
  end
@@ -73,12 +73,23 @@ module Evnt
73
73
  _validates_string_blank if @_result
74
74
  _validates_string_length if @_result
75
75
  _validates_string_regex if @_result
76
+ _validates_string_min_length if @_result
77
+ _validates_string_max_length if @_result
76
78
  when :integer
77
79
  _validates_number_min if @_result
78
80
  _validates_number_max if @_result
79
81
  when :float
80
82
  _validates_number_min if @_result
81
83
  _validates_number_max if @_result
84
+ when :time
85
+ _validates_time_min if @_result
86
+ _validates_time_max if @_result
87
+ when :date
88
+ _validates_time_min if @_result
89
+ _validates_time_max if @_result
90
+ when :datetime
91
+ _validates_time_min if @_result
92
+ _validates_time_max if @_result
82
93
  end
83
94
  end
84
95
 
@@ -183,6 +194,16 @@ module Evnt
183
194
  @_result = @value.length == @_options[:length]
184
195
  end
185
196
 
197
+ def _validates_string_min_length
198
+ return if @value.nil? || @_options[:min_length].nil?
199
+ @_result = @value.length >= @_options[:min_length]
200
+ end
201
+
202
+ def _validates_string_max_length
203
+ return if @value.nil? || @_options[:max_length].nil?
204
+ @_result = @value.length <= @_options[:max_length]
205
+ end
206
+
186
207
  def _validates_string_regex
187
208
  return if @value.nil? || @_options[:regex].nil?
188
209
  @_result = @value.match?(@_options[:regex])
@@ -201,6 +222,19 @@ module Evnt
201
222
  @_result = @value <= @_options[:max]
202
223
  end
203
224
 
225
+ # Time validations:
226
+ ##########################################################################
227
+
228
+ def _validates_time_min
229
+ return if @value.nil? || @_options[:min].nil?
230
+ @_result = @value >= @_options[:min]
231
+ end
232
+
233
+ def _validates_time_max
234
+ return if @value.nil? || @_options[:max].nil?
235
+ @_result = @value <= @_options[:max]
236
+ end
237
+
204
238
  end
205
239
 
206
240
  end
@@ -3,6 +3,6 @@
3
3
  # Evnt.
4
4
  module Evnt
5
5
 
6
- VERSION = '3.1.1'
6
+ VERSION = '3.1.2'
7
7
 
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evnt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ideonetwork
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-21 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler