validy 1.0.9 → 1.0.99

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/validy.rb +12 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 475280444f31f47490b4dd28429c4003991c76d369e80527701a13587473327a
4
- data.tar.gz: 678f9a4d43a4865ef90693f91b1d16b090ce55c4b0b604bcddd464d124aad2b7
3
+ metadata.gz: d89bc7ec77c5a43d71df94fa67ed470ec6865eb251779ece8e4cf8d34dd85247
4
+ data.tar.gz: 3e8e93f9566766992b46c30db7e9b1013eb55d758b3a8524775545ed7c0bdad2
5
5
  SHA512:
6
- metadata.gz: e7c134c99e20b1092defd3c4fd83662f700822067975466e3a988d52798b2dbb483ecb7b336ef7f07eaf90a4d22f3664b43169b80d947e9aa4024b3340a8c810
7
- data.tar.gz: '0289be294713079964b006512ec6f8dbf503b24b65011ca7e5a48b114452e13a57c426dede5cdfa407dab219042ceb6ec5211ecfbc8f3058abc5a5c3d045039f'
6
+ metadata.gz: 9eb955a7874c1df5da04f1f5ab99a8f5d5c84bbbc58f12532f8f69ba728559af93adcd48f4a85bb1117c569586683b9f608bacfba5654a1449b7a0db6850a9ea
7
+ data.tar.gz: f3c7310ee04b5d41dbf35188afb4ba73a8ac779013636f485caa89afd803e580e846839387bf04e663944de20a561afc4d1b6dd3db5c7a357007fc2a43318f92
data/lib/validy.rb CHANGED
@@ -30,6 +30,8 @@ module Validy
30
30
  end
31
31
 
32
32
  module ClassMethods
33
+ # @param [String] method - indicates custom, must be implemented method for which will be triggered for defining
34
+ # validation state
33
35
  def validy_on(method:)
34
36
  method_with_bang_name = (method[-1] == '!' ? method.to_s : "#{method}!")
35
37
  method_without_bang_name = method_with_bang_name.gsub('!', '')
@@ -79,6 +81,9 @@ module Validy
79
81
  end
80
82
 
81
83
  # "condition" evaluates either passed block or instance method represented in the instance
84
+ # @param [String|block] method or callable object which will be triggered for validation
85
+ # @param [String|Hash] error definition
86
+ # @param [Proc] block
82
87
  def condition(method, error = nil, &block)
83
88
  return self unless valid?
84
89
 
@@ -88,6 +93,9 @@ module Validy
88
93
  end
89
94
 
90
95
  # "required" checks presence of the variable
96
+ # @param [String] attribute a target one
97
+ # @param [String|Hash] error custom defined error message
98
+ # @param [Proc] block
91
99
  def required(attribute, error = nil, &block)
92
100
  return self unless valid?
93
101
 
@@ -97,6 +105,7 @@ module Validy
97
105
  end
98
106
 
99
107
  # "optional" starts void validation for the given attribute
108
+ # @param [String] attribute a target one
100
109
  def optional(attribute)
101
110
  return self unless valid?
102
111
 
@@ -105,6 +114,9 @@ module Validy
105
114
  end
106
115
 
107
116
  # "type" validates type of the instance variable
117
+ # @param [Object] clazz for checking type of the target attribute
118
+ # @param [nil] error custom defined error message
119
+ # @param [Proc] block
108
120
  def type(clazz, error = nil, &block)
109
121
  return self unless valid?
110
122
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov