rock-n-code-validations4r 0.0.5 → 0.0.6
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.
- data/README +29 -3
- data/TODO +22 -2
- metadata +2 -2
data/README
CHANGED
@@ -6,13 +6,39 @@ Simple Ruby built-in validations.
|
|
6
6
|
|
7
7
|
=== Purpose.
|
8
8
|
|
9
|
-
|
9
|
+
Provide the developer with a mechanism to verify and validate instances against
|
10
|
+
the types defined by the Ruby interpreter.
|
10
11
|
|
11
12
|
=== Concept.
|
12
13
|
|
13
|
-
|
14
|
+
It is widely known that Ruby, due to its dynamic nature, provides an extremely
|
15
|
+
flexible type checking based on the lack of type checking. This usually proves
|
16
|
+
to be a great advantage for almost every situation every Ruby developer is used
|
17
|
+
to encounter on a daily basis but, sometimes, it is important to assure that
|
18
|
+
specific method should react accordingly a certain given instance.
|
19
|
+
|
20
|
+
Several kind of approaches have been proposed in order to address this
|
21
|
+
limitation. The most common chosen approach is the use of testing frameworks
|
22
|
+
(such as Test::Unit, RSpec or Cucumber) in order to partially assure a given
|
23
|
+
argument is properly verified and validated. Certainly, the drawback of this
|
24
|
+
approach is the difficulty and the frustration that appears when the developer
|
25
|
+
starts writing the test cases. Another common approaches are the manual coding
|
26
|
+
of dynamic type checking or duck typing mechanisms within the required methods
|
27
|
+
by using built-in functionality such as Object#is_a?, Object#kind_of?,
|
28
|
+
Object#instance_of? and Object#respond_to? methods. Even tough these latter
|
29
|
+
approaches are more appropriate from a conceptual point of view, the developer
|
30
|
+
would easily realize that the source code becomes repetitive and less
|
31
|
+
transparent.
|
32
|
+
|
33
|
+
With the help of "Validator", a pure Ruby DSL for writing validations, this
|
34
|
+
library proposes a mini-framework that classify the existing built-in types
|
35
|
+
within Ruby into groups, define possible rules for every each of them and allow
|
36
|
+
its validations within any Ruby code. The developer just needs to pass any
|
37
|
+
instance to the validation method with a selected group and additional
|
38
|
+
conditions if required.
|
14
39
|
|
15
40
|
=== Features.
|
16
41
|
|
17
42
|
The current version of this library implements these features:
|
18
|
-
-
|
43
|
+
- Support for each every Ruby built-in type.
|
44
|
+
- Support for conditional rules in widely-used types.
|
data/TODO
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
=== ToDo's
|
2
|
-
* Define the group for the class that will validate +NilClass+ instances.
|
3
2
|
* Write tests for the class that will validate +NilClass+ instances.
|
4
|
-
* Define the group
|
3
|
+
* Define the group for the class that will validate +NilClass+ instances.
|
5
4
|
* Write tests for the class that will validate +TrueClass+ and +FalseClass+ instances.
|
5
|
+
* Define the group and rules for the class that will validate +TrueClass+ and +FalseClass+ instances.
|
6
|
+
* Write tests for the class that will validate +String+ instances.
|
7
|
+
* Define the group for the class that will validate +String+ instances.
|
8
|
+
* Write tests for the class that will validate +Symbol+ instances.
|
9
|
+
* Define the group for the class that will validate +Symbol+ instances.
|
10
|
+
* Write tests for the class that will validate +Fixnum+, +Bignum+, +Float+, +Rational+, +Complex+ instances.
|
11
|
+
* Define the group for the class that will validate +Fixnum+, +Bignum+, +Float+, +Rational+, +Complex+ instances.
|
12
|
+
* Write tests for the class that will validate +Range+ instances.
|
13
|
+
* Define the group for the class that will validate +Range+ instances.
|
14
|
+
* Write tests for the class that will validate +Array+ instances.
|
15
|
+
* Define the group for the class that will validate +Array+ instances.
|
16
|
+
* Write tests for the class that will validate +Hash+ instances.
|
17
|
+
* Define the group for the class that will validate +Hash+ instances.
|
18
|
+
* Write tests for the class that will validate +Struct+ and +OpenStruct+ instances.
|
19
|
+
* Define the group for the class that will validate +Struct+ and +OpenStruct+ instances.
|
20
|
+
* Write tests for the class that will validate +Regexp+ instances.
|
21
|
+
* Define the group for the class that will validate +Regexp+ instances.
|
22
|
+
* Write tests for the class that will validate +Time+ and +Date+ instances.
|
23
|
+
* Define the group for the class that will validate +Time+ and +Date+ instances.
|
24
|
+
* Write tests for the class that will validate the instances of the rest of the classes.
|
25
|
+
* Define the group for the class that will validate the instances of the rest of the classes.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock-n-code-validations4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julio Javier Cicchelli
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-29 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|