strongly_typed 0.0.1 → 0.0.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 +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/.yardopts +1 -1
- data/CHANGELOG.md +23 -0
- data/{LICENSE.txt → LICENSE.md} +0 -0
- data/README.md +45 -22
- data/lib/strongly_typed/version.rb +1 -1
- data/strongly_typed.gemspec +8 -12
- metadata +40 -49
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f0bae5b6fc3e2980229802c90a4ed9d6729ab18f
|
4
|
+
data.tar.gz: 50515ef3ab3fd63d748e286c30df661127a45e7e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d9625762d322eb83230e0863b9cd03102a39abf9aad15d318d654791bbe61497193b689832f969b8da3521ee253b9c75c1fe371cdc2b4a57653d162015c28589
|
7
|
+
data.tar.gz: e06bd179b0f4c7815e8783fbfd80350cc0d777e6a54072c0081bd58df3e64b6b21a487bae0490df911fa256423a7a4d727579d9e8b44513b4dbc6165c6a68e4a
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p0
|
data/.travis.yml
CHANGED
data/.yardopts
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
## [In git](https://github.com/elgalu/strongly_typed/compare/v0.0.1...HEAD)
|
2
|
+
|
3
|
+
### New Features
|
4
|
+
* n/a
|
5
|
+
|
6
|
+
### Bugfixes
|
7
|
+
* n/a
|
8
|
+
|
9
|
+
### Chores
|
10
|
+
* Added this Change Log file (Leo Gallucci)
|
11
|
+
* Added Code Climate badge and Dependency Status badge (Leo Gallucci)
|
12
|
+
* README.md, Gemfile, gemspec improvements (Leo Gallucci)
|
13
|
+
* Confirmed support for ruby 2.0.0-p0, added more rubies to travis, added .ruby-version file (Leo Gallucci)
|
14
|
+
|
15
|
+
## [v0.0.1](https://github.com/elgalu/strongly_typed/tree/v0.0.1)
|
16
|
+
|
17
|
+
## First gem release
|
18
|
+
|
19
|
+
### Features:
|
20
|
+
* StronglyTyped::Model allows to call `attribute()` to define your object properties. (Leo Gallucci)
|
21
|
+
* Instance initialization with a hash, a.k.a named parameters. (Leo Gallucci)
|
22
|
+
* Instance initialization with same old way ordered parameters. (Leo Gallucci)
|
23
|
+
* Type conversions when possible. (Leo Gallucci)
|
data/{LICENSE.txt → LICENSE.md}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# StronglyTyped
|
2
2
|
|
3
|
-
[![Build Status]
|
4
|
-
[![Dependency Status]
|
5
|
-
[![Code Climate]
|
3
|
+
[![Build Status][BS img]][Build Status]
|
4
|
+
[![Dependency Status][DS img]][Dependency Status]
|
5
|
+
[![Code Climate][CC img]][Code Climate]
|
6
|
+
|
7
|
+
## Description
|
6
8
|
|
7
9
|
This gem provides similar functionality as ruby core [Struct][] but instead of [inheritance][] i used [mixins][] and even wrote [something][blog on mixins] about my reasons to do so.
|
8
10
|
|
@@ -22,17 +24,7 @@ I took some ideas from others gems like [virtus][] and [structure][] but since n
|
|
22
24
|
|
23
25
|
## Installation
|
24
26
|
|
25
|
-
Add
|
26
|
-
|
27
|
-
gem 'strongly_typed'
|
28
|
-
|
29
|
-
And then execute:
|
30
|
-
|
31
|
-
$ bundle
|
32
|
-
|
33
|
-
Or install it yourself as:
|
34
|
-
|
35
|
-
$ gem install strongly_typed
|
27
|
+
Add `gem 'strongly_typed'` to your [Gemfile][] then run [bundle install][] or simply `$ gem install strongly_typed`
|
36
28
|
|
37
29
|
## Usage
|
38
30
|
|
@@ -87,18 +79,49 @@ Check the [full API here][]
|
|
87
79
|
|
88
80
|
## Contributing
|
89
81
|
|
90
|
-
1. Fork it
|
91
|
-
2.
|
92
|
-
3.
|
93
|
-
|
94
|
-
|
82
|
+
1. Fork it.
|
83
|
+
2. Make your feature addition or bug fix and create your feature branch.
|
84
|
+
3. Update the [Change Log][].
|
85
|
+
3. Add specs/tests for it. This is important so I don't break it in a future version unintentionally.
|
86
|
+
4. Commit, create a new Pull Request.
|
87
|
+
5. Check that your pull request passes the [build][travis pull requests].
|
95
88
|
|
96
|
-
### TODO
|
97
|
-
+ Improve generic TypeError to also show attribute name, expected type and value received instead
|
98
|
-
+ On coercible.rb require gem 'double' to avoid requiring 'date' when user doesn't need that
|
89
|
+
### TODO for StronglyTyped::Model
|
99
90
|
+ Add :default => 'value' to attribute() to support defaults
|
100
91
|
+ Add :required => true/false to attribute() so an ArgumentError is raised when not provided
|
101
92
|
|
93
|
+
### TODO for StronglyTyped::Coercible
|
94
|
+
+ Extract coercer to another gem or use already existing coercion gem
|
95
|
+
+ Improve generic TypeError to also show attribute name, expected type and value received instead
|
96
|
+
+ On coercible.rb require gem 'double' to avoid requiring 'date' when user doesn't need that
|
97
|
+
+ Add support for BigDecimal
|
98
|
+
|
99
|
+
## License
|
100
|
+
|
101
|
+
Released under the MIT License. See the [LICENSE][] file for further details.
|
102
|
+
|
103
|
+
## Links
|
104
|
+
|
105
|
+
[RubyGems][] | [Documentation][] | [Source][] | [Bugtracker][] | [Build Status][] | [Dependency Status][] | [Code Climate][]
|
106
|
+
|
107
|
+
[bundle install]: http://gembundler.com/man/bundle-install.1.html
|
108
|
+
[Gemfile]: http://gembundler.com/man/gemfile.5.html
|
109
|
+
[LICENSE]: LICENSE.md
|
110
|
+
[Change Log]: CHANGELOG.md
|
111
|
+
|
112
|
+
[RubyGems]: https://rubygems.org/gems/strongly_typed
|
113
|
+
[Documentation]: http://rubydoc.info/gems/strongly_typed
|
114
|
+
[Source]: https://github.com/elgalu/strongly_typed
|
115
|
+
[Bugtracker]: https://github.com/elgalu/strongly_typed/issues
|
116
|
+
|
117
|
+
[BS img]: https://travis-ci.org/elgalu/strongly_typed.png
|
118
|
+
[DS img]: https://gemnasium.com/elgalu/strongly_typed.png
|
119
|
+
[CC img]: https://codeclimate.com/github/elgalu/strongly_typed.png
|
120
|
+
|
121
|
+
[Build Status]: https://travis-ci.org/elgalu/strongly_typed
|
122
|
+
[travis pull requests]: https://travis-ci.org/elgalu/strongly_typed/pull_requests
|
123
|
+
[Dependency Status]: https://gemnasium.com/elgalu/strongly_typed
|
124
|
+
[Code Climate]: https://codeclimate.com/github/elgalu/strongly_typed
|
102
125
|
|
103
126
|
[strongly_typed]: https://github.com/elgalu/strongly_typed
|
104
127
|
[full API here]: http://rubydoc.info/gems/strongly_typed/frames/file/README.md
|
data/strongly_typed.gemspec
CHANGED
@@ -8,16 +8,11 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.platform = Gem::Platform::RUBY
|
9
9
|
gem.name = "strongly_typed"
|
10
10
|
gem.version = StronglyTyped::VERSION
|
11
|
-
gem.summary = %q{Simple type validation for plain ruby object attributes that
|
12
|
-
gem.description =
|
13
|
-
A simple type validation tool for plain ruby object attributes that performs conversions when possible.
|
14
|
-
Similar to ruby-core Struct but i didn't like using inheritance for something more appropriate for mixins.
|
15
|
-
Check virtus gem if you are looking for a full featured attributes settings for your Ruby Objects that requires complex automatic coercions among other things.
|
16
|
-
If you are looking for a nestable, coercible, Hash-like data structure take a look at structure gem.
|
17
|
-
DESC
|
11
|
+
gem.summary = %q{Simple type validation for plain ruby object attributes that perform conversions whenever possible.}
|
12
|
+
gem.description = gem.summary
|
18
13
|
|
19
|
-
gem.required_ruby_version = '>= 1.9.
|
20
|
-
gem.required_rubygems_version = '>= 1.8
|
14
|
+
gem.required_ruby_version = '>= 1.9.2'
|
15
|
+
gem.required_rubygems_version = '>= 1.8'
|
21
16
|
|
22
17
|
gem.license = 'MIT'
|
23
18
|
|
@@ -30,10 +25,11 @@ DESC
|
|
30
25
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
31
26
|
gem.require_paths = ["lib"]
|
32
27
|
|
33
|
-
gem.add_runtime_dependency "boolean_class", "
|
28
|
+
gem.add_runtime_dependency "boolean_class", ">= 0.0.3"
|
34
29
|
|
35
|
-
gem.add_development_dependency "
|
36
|
-
gem.add_development_dependency "
|
30
|
+
gem.add_development_dependency "bundler", ">= 1.2"
|
31
|
+
gem.add_development_dependency "rake"
|
32
|
+
gem.add_development_dependency "rspec", "~> 2.13"
|
37
33
|
gem.add_development_dependency "redcarpet", "~> 2.2"
|
38
34
|
gem.add_development_dependency "yard", "~> 0.8"
|
39
35
|
gem.add_development_dependency "simplecov", "~> 0.7"
|
metadata
CHANGED
@@ -1,68 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strongly_typed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Leo Gallucci
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
11
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: boolean_class
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 0.0.3
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 0.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: rake
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
|
-
- -
|
45
|
+
- - '>='
|
36
46
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
47
|
+
version: '0'
|
38
48
|
type: :development
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
|
-
- -
|
52
|
+
- - '>='
|
44
53
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
54
|
+
version: '0'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: rspec
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
59
|
- - ~>
|
52
60
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2.
|
61
|
+
version: '2.13'
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
66
|
- - ~>
|
60
67
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
68
|
+
version: '2.13'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: redcarpet
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
73
|
- - ~>
|
68
74
|
- !ruby/object:Gem::Version
|
@@ -70,7 +76,6 @@ dependencies:
|
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
80
|
- - ~>
|
76
81
|
- !ruby/object:Gem::Version
|
@@ -78,7 +83,6 @@ dependencies:
|
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: yard
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
87
|
- - ~>
|
84
88
|
- !ruby/object:Gem::Version
|
@@ -86,7 +90,6 @@ dependencies:
|
|
86
90
|
type: :development
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
94
|
- - ~>
|
92
95
|
- !ruby/object:Gem::Version
|
@@ -94,7 +97,6 @@ dependencies:
|
|
94
97
|
- !ruby/object:Gem::Dependency
|
95
98
|
name: simplecov
|
96
99
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
100
|
requirements:
|
99
101
|
- - ~>
|
100
102
|
- !ruby/object:Gem::Version
|
@@ -102,24 +104,12 @@ dependencies:
|
|
102
104
|
type: :development
|
103
105
|
prerelease: false
|
104
106
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
107
|
requirements:
|
107
108
|
- - ~>
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0.7'
|
110
|
-
description:
|
111
|
-
|
112
|
-
|
113
|
-
Similar to ruby-core Struct but i didn''t like using inheritance for something more
|
114
|
-
appropriate for mixins.
|
115
|
-
|
116
|
-
Check virtus gem if you are looking for a full featured attributes settings for
|
117
|
-
your Ruby Objects that requires complex automatic coercions among other things.
|
118
|
-
|
119
|
-
If you are looking for a nestable, coercible, Hash-like data structure take a look
|
120
|
-
at structure gem.
|
121
|
-
|
122
|
-
'
|
111
|
+
description: Simple type validation for plain ruby object attributes that perform
|
112
|
+
conversions whenever possible.
|
123
113
|
email:
|
124
114
|
- elgalu3@gmail.com
|
125
115
|
executables: []
|
@@ -128,10 +118,12 @@ extra_rdoc_files: []
|
|
128
118
|
files:
|
129
119
|
- .gitignore
|
130
120
|
- .rspec
|
121
|
+
- .ruby-version
|
131
122
|
- .travis.yml
|
132
123
|
- .yardopts
|
124
|
+
- CHANGELOG.md
|
133
125
|
- Gemfile
|
134
|
-
- LICENSE.
|
126
|
+
- LICENSE.md
|
135
127
|
- README.md
|
136
128
|
- Rakefile
|
137
129
|
- lib/strongly_typed.rb
|
@@ -146,29 +138,28 @@ files:
|
|
146
138
|
homepage: https://github.com/elgalu/strongly_typed
|
147
139
|
licenses:
|
148
140
|
- MIT
|
141
|
+
metadata: {}
|
149
142
|
post_install_message:
|
150
143
|
rdoc_options: []
|
151
144
|
require_paths:
|
152
145
|
- lib
|
153
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
147
|
requirements:
|
156
|
-
- -
|
148
|
+
- - '>='
|
157
149
|
- !ruby/object:Gem::Version
|
158
|
-
version: 1.9.
|
150
|
+
version: 1.9.2
|
159
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
-
none: false
|
161
152
|
requirements:
|
162
|
-
- -
|
153
|
+
- - '>='
|
163
154
|
- !ruby/object:Gem::Version
|
164
|
-
version: 1.8
|
155
|
+
version: '1.8'
|
165
156
|
requirements: []
|
166
157
|
rubyforge_project:
|
167
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.0.0
|
168
159
|
signing_key:
|
169
|
-
specification_version:
|
170
|
-
summary: Simple type validation for plain ruby object attributes that
|
171
|
-
|
160
|
+
specification_version: 4
|
161
|
+
summary: Simple type validation for plain ruby object attributes that perform conversions
|
162
|
+
whenever possible.
|
172
163
|
test_files:
|
173
164
|
- spec/coercible_spec.rb
|
174
165
|
- spec/model_spec.rb
|