intrinsic 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.mdown +13 -4
- data/README.md +4 -4
- data/lib/intrinsic/intrinsicism/coercion.rb +3 -0
- data/lib/intrinsic/intrinsicism/coercion/array.rb +15 -0
- data/lib/intrinsic/intrinsicism/coercion/hash.rb +16 -0
- data/lib/intrinsic/intrinsicism/coercion/integer.rb +12 -4
- data/lib/intrinsic/intrinsicism/coercion/proc.rb +12 -4
- data/lib/intrinsic/intrinsicism/coercion/string.rb +12 -4
- data/lib/intrinsic/intrinsicism/coercion/symbol.rb +15 -0
- data/lib/intrinsic/version.rb +1 -1
- metadata +11 -8
data/CHANGELOG.mdown
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
1.2.0 / 2012-01-09
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Adding the symbol coercion logic
|
5
|
+
* Adding the hash coercion logic
|
6
|
+
* Adding the array coercion logic
|
7
|
+
* Wrapping coercion in begin/rescue blocks with raise typerrors
|
8
|
+
* Switching from classes to modules
|
9
|
+
* Switching to nested structure for coercion
|
10
|
+
|
11
|
+
|
1
12
|
1.1.0 / 2012-01-08
|
2
13
|
==================
|
3
14
|
|
@@ -8,8 +19,8 @@
|
|
8
19
|
* Detailing the internals of the included hook
|
9
20
|
* Documenting the included hook
|
10
21
|
* Documenting details about the intrinsic model
|
11
|
-
*
|
12
|
-
*
|
22
|
+
* Adding an example of usage from the sample file
|
23
|
+
* Adding a list of pros and cons for Virtus
|
13
24
|
* Adding a list of pros and cons for activemodel
|
14
25
|
* Adding a section on alternatives
|
15
26
|
* Adding in the two people who deserve credit the most
|
@@ -17,7 +28,6 @@
|
|
17
28
|
* Adding chainable syntax detail
|
18
29
|
* Extrapolating on idea
|
19
30
|
* Adding code markup
|
20
|
-
* Adding code markup
|
21
31
|
|
22
32
|
|
23
33
|
1.0.3 / 2012-01-08
|
@@ -32,7 +42,6 @@
|
|
32
42
|
1.0.0 / 2012-01-08
|
33
43
|
==================
|
34
44
|
|
35
|
-
* Merge branch 'release/1.0.0' into develop
|
36
45
|
* Incrementing the version number.
|
37
46
|
* Assigning errors if validation result was false
|
38
47
|
* Assigning the false setter to validation_result if raised
|
data/README.md
CHANGED
@@ -67,9 +67,8 @@ Here's a list of what those alternatives are and why I think Intrinsic should ex
|
|
67
67
|
- **Pro**: Well maintained and contributed too.
|
68
68
|
- Pro: Extremely well tested and documented
|
69
69
|
- Pro: Extended feature set above and beyond intrinsic
|
70
|
-
- **Con**:
|
71
|
-
- Con:
|
72
|
-
- Con: No validation system planned or in feature set
|
70
|
+
- **Con**: Still not version 1.0.0, and thus has an unstable API
|
71
|
+
- Con: Does not have any validation logic (although there is a [WIP gem](https://github.com/emmanuel/aequitas))
|
73
72
|
|
74
73
|
All of these alternatives are worth looking into!
|
75
74
|
|
@@ -93,7 +92,7 @@ Or add it to your `Gemfile`:
|
|
93
92
|
``` ruby
|
94
93
|
source :rubygems
|
95
94
|
|
96
|
-
gem "intrinsic", "1.
|
95
|
+
gem "intrinsic", "1.2.0"
|
97
96
|
```
|
98
97
|
|
99
98
|
That's all you have to do.
|
@@ -120,6 +119,7 @@ We welcome any pull requests or commits that improve `intrinsic`.
|
|
120
119
|
changelog
|
121
120
|
---------
|
122
121
|
|
122
|
+
- 1.2.0: Adding Hash, Array, Symbol coercion and refactoring Proc, String, Integer coercion
|
123
123
|
- 1.1.0: Documentation of the intrinsic module, updating of readme details
|
124
124
|
- 1.0.3: Adding helpful README and license, updating example script
|
125
125
|
- 1.0.0: Initial release
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Intrinsic
|
2
|
+
module Intrinsicism
|
3
|
+
module Coercion
|
4
|
+
module Hash
|
5
|
+
def self.convert(value)
|
6
|
+
case value
|
7
|
+
when Hash then value
|
8
|
+
when Array then Hash[*value.flatten]
|
9
|
+
when Integer then raise TypeError
|
10
|
+
when String then raise TypeError
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,7 +1,15 @@
|
|
1
|
-
module Intrinsic
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Intrinsic
|
2
|
+
module Intrinsicism
|
3
|
+
module Coercion
|
4
|
+
module Integer
|
5
|
+
def self.convert(value)
|
6
|
+
begin
|
7
|
+
value.to_i
|
8
|
+
rescue
|
9
|
+
raise TypeError
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
5
13
|
end
|
6
14
|
end
|
7
15
|
end
|
@@ -1,7 +1,15 @@
|
|
1
|
-
module Intrinsic
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Intrinsic
|
2
|
+
module Intrinsicism
|
3
|
+
module Coercion
|
4
|
+
module Proc
|
5
|
+
def self.convert(value)
|
6
|
+
begin
|
7
|
+
value.to_proc
|
8
|
+
rescue
|
9
|
+
raise TypeError
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
5
13
|
end
|
6
14
|
end
|
7
15
|
end
|
@@ -1,7 +1,15 @@
|
|
1
|
-
module Intrinsic
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Intrinsic
|
2
|
+
module Intrinsicism
|
3
|
+
module Coercion
|
4
|
+
module String
|
5
|
+
def self.convert(value)
|
6
|
+
begin
|
7
|
+
value.to_s
|
8
|
+
rescue
|
9
|
+
raise TypeError
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
5
13
|
end
|
6
14
|
end
|
7
15
|
end
|
data/lib/intrinsic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intrinsic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161916460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2161916460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yard
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161915960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.7.4
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161915960
|
36
36
|
description: Intrinsic adds properties to your objects
|
37
37
|
email:
|
38
38
|
- kurtisrainboltgreene@gmail.com
|
@@ -53,9 +53,12 @@ files:
|
|
53
53
|
- lib/intrinsic/extrinsicism.rb
|
54
54
|
- lib/intrinsic/intrinsicism.rb
|
55
55
|
- lib/intrinsic/intrinsicism/coercion.rb
|
56
|
+
- lib/intrinsic/intrinsicism/coercion/array.rb
|
57
|
+
- lib/intrinsic/intrinsicism/coercion/hash.rb
|
56
58
|
- lib/intrinsic/intrinsicism/coercion/integer.rb
|
57
59
|
- lib/intrinsic/intrinsicism/coercion/proc.rb
|
58
60
|
- lib/intrinsic/intrinsicism/coercion/string.rb
|
61
|
+
- lib/intrinsic/intrinsicism/coercion/symbol.rb
|
59
62
|
- lib/intrinsic/intrinsicism/validation.rb
|
60
63
|
- lib/intrinsic/version.rb
|
61
64
|
- test/helper.rb
|
@@ -74,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
77
|
version: '0'
|
75
78
|
segments:
|
76
79
|
- 0
|
77
|
-
hash: -
|
80
|
+
hash: -4546154415391608797
|
78
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
82
|
none: false
|
80
83
|
requirements:
|
@@ -83,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
86
|
version: '0'
|
84
87
|
segments:
|
85
88
|
- 0
|
86
|
-
hash: -
|
89
|
+
hash: -4546154415391608797
|
87
90
|
requirements: []
|
88
91
|
rubyforge_project:
|
89
92
|
rubygems_version: 1.8.10
|