attributary 0.1.0 → 0.1.3
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 +4 -4
- data/.rspec_status +15 -0
- data/Gemfile +0 -3
- data/LICENSE +21 -0
- data/README.md +38 -1
- data/attributary.gemspec +4 -0
- data/lib/attributary.rb +16 -6
- data/lib/attributary/all.rb +7 -0
- data/lib/attributary/config.rb +9 -3
- data/lib/attributary/dsl.rb +16 -75
- data/lib/attributary/dsl/accessors.rb +45 -0
- data/lib/attributary/dsl/castings.rb +28 -0
- data/lib/attributary/dsl/error.rb +13 -0
- data/lib/attributary/dsl/helpers.rb +38 -0
- data/lib/attributary/dsl/validations.rb +42 -0
- data/lib/attributary/errors.rb +4 -0
- data/lib/attributary/initializer.rb +1 -1
- data/lib/attributary/serializer.rb +21 -0
- data/lib/attributary/type.rb +0 -9
- data/lib/attributary/version.rb +1 -1
- metadata +42 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 521f68ae59d9b4342cf782032031b3b3f89783a9
|
4
|
+
data.tar.gz: 1c90025b9fa2c89e2b3fe840f09a401933fdc6ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8ca0e1373df36cba4a85ab7070afd78bd80f6f28fb8bbd8d58d9185e5c781f68c70fa6cb53708927ccc37a0bfda69bb43d9f35f8dfb755184ab5a8b5c4143cf
|
7
|
+
data.tar.gz: fdacaca03e9e2ffca3de0de4ea09ccc3bbfda882151389ab731b76ebe612c1c8c8ce7a18b6f89ee067898e6e43b5a1773486fb75222a69e5c5c352e222ff2446
|
data/.rspec_status
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------------------ | ------ | --------------- |
|
3
|
+
./spec/unit/attributary/attribute_spec.rb[1:1:1] | passed | 0.00034 seconds |
|
4
|
+
./spec/unit/attributary/attribute_spec.rb[1:1:2] | passed | 0.00008 seconds |
|
5
|
+
./spec/unit/attributary/attribute_spec.rb[1:1:3] | passed | 0.00012 seconds |
|
6
|
+
./spec/unit/attributary/attribute_spec.rb[1:1:4] | passed | 0.00013 seconds |
|
7
|
+
./spec/unit/attributary/attribute_spec.rb[1:2:1] | passed | 0.00009 seconds |
|
8
|
+
./spec/unit/attributary/attribute_spec.rb[1:2:2] | passed | 0.00007 seconds |
|
9
|
+
./spec/unit/attributary/attribute_spec.rb[1:3:1] | passed | 0.00081 seconds |
|
10
|
+
./spec/unit/attributary/attribute_spec.rb[1:3:2] | passed | 0.00012 seconds |
|
11
|
+
./spec/unit/attributary/attribute_spec.rb[1:4:1] | passed | 0.0001 seconds |
|
12
|
+
./spec/unit/attributary/attribute_spec.rb[1:4:2] | passed | 0.0001 seconds |
|
13
|
+
./spec/unit/attributary/attribute_spec.rb[1:5:1] | passed | 0.00012 seconds |
|
14
|
+
./spec/unit/attributary/attribute_spec.rb[1:6:1] | passed | 0.00011 seconds |
|
15
|
+
./spec/unit/attributary/attribute_spec.rb[1:7:1] | passed | 0.0001 seconds |
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Josh Brody
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -25,6 +25,16 @@ Or install it yourself as:
|
|
25
25
|
Attributary.configure do |c|
|
26
26
|
c.dsl_name = :donkey # defaults to :attrubute
|
27
27
|
c.strict_mode = false # set this to `true` to skip casting in the writer method (raises TypeError)
|
28
|
+
c.raise_errors = false # set this to true to raise errors when collection/validation fails
|
29
|
+
end
|
30
|
+
|
31
|
+
You can also set this on an object-by-object basis.
|
32
|
+
|
33
|
+
class Character
|
34
|
+
include Attributary::DSL
|
35
|
+
attributary do |c|
|
36
|
+
c.raise_errors = true
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
### Actually using it
|
@@ -60,6 +70,10 @@ Have to initialize other stuff? Send a hash to attributary_initialize
|
|
60
70
|
include Attributary::Initializer
|
61
71
|
include Attributary::DSL
|
62
72
|
|
73
|
+
attributary do |c|
|
74
|
+
c.raise_errors = true
|
75
|
+
end
|
76
|
+
|
63
77
|
donkey :gender, :symbol, default: :male
|
64
78
|
|
65
79
|
def initialize(name, attributary_attributes = {})
|
@@ -82,6 +96,10 @@ Simply pass an array of the possible options for the attribute.
|
|
82
96
|
class Character
|
83
97
|
include Attributary::DSL
|
84
98
|
|
99
|
+
attributary do |c|
|
100
|
+
c.raise_errors = true
|
101
|
+
end
|
102
|
+
|
85
103
|
donkey :gender, :symbol, default: :male, collection: [:male, :female]
|
86
104
|
end
|
87
105
|
|
@@ -99,6 +117,10 @@ Pass a proc or a method name.
|
|
99
117
|
class Character
|
100
118
|
include Attributary::DSL
|
101
119
|
|
120
|
+
attributary do |c|
|
121
|
+
c.raise_errors = true
|
122
|
+
end
|
123
|
+
|
102
124
|
donkey :gender, :symbol, default: :male, validates: proc { |value| [:male, :female].include?(value) }
|
103
125
|
end
|
104
126
|
|
@@ -107,7 +129,6 @@ Pass a proc or a method name.
|
|
107
129
|
character.gender = :left # raises CollectionValidationError
|
108
130
|
character.gender = 'female' # gets casted correctly, and doesn't raise an error
|
109
131
|
|
110
|
-
|
111
132
|
### Types
|
112
133
|
|
113
134
|
Supports some really naive typecasting. [See the supported types](https://github.com/joshmn/attributary/tree/master/lib/attributary/types). Create your own by inheriting from `Attributary::Types` and naming it like `ClassNameType`
|
@@ -122,6 +143,22 @@ Supports some really naive typecasting. [See the supported types](https://github
|
|
122
143
|
end
|
123
144
|
end
|
124
145
|
|
146
|
+
## Error handling
|
147
|
+
|
148
|
+
If the configuration `raise_errors` is false, the object will have their accessible errors on the `attributary_errors` instance method, which is a hash of `{attribute_name: error object}`
|
149
|
+
|
150
|
+
class Character
|
151
|
+
include Attributary::DSL
|
152
|
+
|
153
|
+
donkey :gender, :symbol, default: :male, :collection => [:male, :female]
|
154
|
+
end
|
155
|
+
|
156
|
+
character = Character.new
|
157
|
+
character.attributary_errors # {}
|
158
|
+
character.gender = :left # raises CollectionValidationError
|
159
|
+
character.gender = 'female' # gets casted correctly, and doesn't raise an error
|
160
|
+
|
161
|
+
|
125
162
|
## Contributing
|
126
163
|
|
127
164
|
Bug reports and pull requests are welcome on GitHub at https://github.com/joshmn/attributary
|
data/attributary.gemspec
CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = Attributary::VERSION
|
8
8
|
spec.authors = ['Josh Brody']
|
9
9
|
spec.email = ['josh@josh.mn']
|
10
|
+
spec.licenses = ['MIT']
|
10
11
|
|
11
12
|
spec.summary = 'Like ActiveModel::Attributes but less fluffy and more attribute-y.'
|
12
13
|
spec.description = 'Like `ActiveModel::Attributes` but less fluffy and more attribute-y.'
|
@@ -18,7 +19,10 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.bindir = 'exe'
|
19
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
21
|
spec.require_paths = ['lib']
|
22
|
+
spec.files += Dir['lib/**/*.rb']
|
21
23
|
|
22
24
|
spec.add_development_dependency 'bundler', '~> 1.15'
|
23
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'pry', '~> 0.11.3'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
28
|
end
|
data/lib/attributary.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require 'attributary/errors'
|
2
|
+
require 'attributary/config'
|
3
|
+
require 'attributary/core_ext'
|
4
|
+
require 'attributary/type'
|
5
|
+
require 'attributary/types/array_type'
|
6
|
+
require 'attributary/types/big_decimal_type'
|
7
|
+
require 'attributary/types/boolean_type'
|
8
|
+
require 'attributary/types/float_type'
|
9
|
+
require 'attributary/types/hash_type'
|
10
|
+
require 'attributary/types/integer_type'
|
11
|
+
require 'attributary/types/string_type'
|
12
|
+
require 'attributary/types/symbol_type'
|
13
|
+
require 'attributary/initializer'
|
14
|
+
require 'attributary/serializer'
|
15
|
+
require 'attributary/dsl'
|
16
|
+
require 'attributary/version'
|
7
17
|
|
8
18
|
module Attributary
|
9
19
|
end
|
data/lib/attributary/config.rb
CHANGED
@@ -13,11 +13,17 @@ module Attributary
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class Config
|
16
|
-
attr_accessor :dsl_name, :
|
17
|
-
|
16
|
+
attr_accessor :validation_error, :collection_error, :strict_mode, :dsl_name, :raise_errors
|
18
17
|
def initialize
|
19
|
-
@
|
18
|
+
@validation_error = ::Attributary::ValidationError
|
19
|
+
@collection_error = ::Attributary::CollectionValidationError
|
20
20
|
@strict_mode = false
|
21
|
+
@dsl_name = :attribute
|
22
|
+
@raise_errors = false
|
23
|
+
end
|
24
|
+
|
25
|
+
def raise_errors?
|
26
|
+
@raise_errors
|
21
27
|
end
|
22
28
|
|
23
29
|
def strict_mode?
|
data/lib/attributary/dsl.rb
CHANGED
@@ -1,87 +1,28 @@
|
|
1
|
+
require 'attributary/dsl/accessors'
|
2
|
+
require 'attributary/dsl/castings'
|
3
|
+
require 'attributary/dsl/error'
|
4
|
+
require 'attributary/dsl/helpers'
|
5
|
+
require 'attributary/dsl/validations'
|
6
|
+
|
1
7
|
module Attributary
|
2
8
|
module DSL
|
3
|
-
class ValidationError < StandardError; end
|
4
|
-
class CollectionValidationError < StandardError; end
|
5
9
|
|
6
10
|
def self.included(base)
|
7
11
|
base.extend ClassMethods
|
12
|
+
base.include InstanceMethods
|
8
13
|
end
|
9
14
|
|
10
|
-
module
|
11
|
-
def
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def _attributary_attributes
|
16
|
-
hash = {}
|
17
|
-
_attributary_attribute_set.keys.each do |k|
|
18
|
-
hash[k] = instance_variable_get(:"@#{k}")
|
19
|
-
end
|
20
|
-
hash
|
21
|
-
end
|
22
|
-
|
23
|
-
define_method(Attributary.configuration.dsl_name) do |name, type, options = {}|
|
24
|
-
options[:type] = type
|
25
|
-
_attributary_attribute_set[name] = options
|
26
|
-
_attributary_reader(name, type, options)
|
27
|
-
_attributary_writer(name, type, options)
|
28
|
-
end
|
29
|
-
|
30
|
-
def _attributary_reader(name, type, options)
|
31
|
-
define_method(name) do
|
32
|
-
instance_variable_get(:"@#{name}") || if options[:default].is_a?(Proc)
|
33
|
-
options[:default].call
|
34
|
-
else
|
35
|
-
options[:default]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
if type == :boolean
|
39
|
-
define_method("#{name}?") do
|
40
|
-
send(name.to_s)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def _attributary_writer(name, type, options)
|
46
|
-
define_method("#{name}=") do |value|
|
47
|
-
value = self.class._attributary_cast_to(type, value) unless Attributary.configuration.strict_mode?
|
48
|
-
self.class._attributary_check_collection(value, options[:collection]) if options[:collection].is_a?(Array)
|
49
|
-
self.class._attributary_validate_attribute(value, options[:validates])
|
50
|
-
instance_variable_set(:"@#{name}", value)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def _attributary_check_collection(value, collection)
|
55
|
-
unless collection.include?(value)
|
56
|
-
raise CollectionValidationError, "Value `#{value}' is not in the collection #{collection}."
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def _attributary_validate_attribute(value, validator)
|
61
|
-
return true if validator.nil?
|
62
|
-
raise ValidationError, 'Validator failed.' unless validator.call(value)
|
63
|
-
end
|
64
|
-
|
65
|
-
def _attributary_cast_to(type, value)
|
66
|
-
cast_klass = _attributary_cast_class(type)
|
67
|
-
cast_klass.cast_to(value)
|
68
|
-
end
|
69
|
-
|
70
|
-
def _attributary_cast_class(type)
|
71
|
-
cast_klass_name = _attributary_cast_class_name(type)
|
72
|
-
cast_klass = cast_klass_name.safe_constantize
|
73
|
-
if cast_klass.nil?
|
74
|
-
raise NameError, "#{cast_klass_name} is not a valid type."
|
75
|
-
end
|
76
|
-
unless cast_klass.respond_to?(:cast_to)
|
77
|
-
raise NoMethodError, "#{cast_klass} should have a class-method of cast_to"
|
78
|
-
end
|
79
|
-
cast_klass
|
15
|
+
module InstanceMethods
|
16
|
+
def attributary_errors
|
17
|
+
self.class._attributary_errors
|
80
18
|
end
|
19
|
+
end
|
81
20
|
|
82
|
-
|
83
|
-
|
84
|
-
|
21
|
+
module ClassMethods
|
22
|
+
include Accessors
|
23
|
+
include Castings
|
24
|
+
include Helpers
|
25
|
+
include Validations
|
85
26
|
end
|
86
27
|
end
|
87
28
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Attributary
|
2
|
+
module DSL
|
3
|
+
module Accessors
|
4
|
+
|
5
|
+
define_method(Attributary.configuration.dsl_name) do |name, type, options = {}|
|
6
|
+
options[:type] = type
|
7
|
+
_attributary_attribute_set[name] = options
|
8
|
+
_attributary_writer(name, type, options)
|
9
|
+
_attributary_reader(name, type, options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def _attributary_writer(name, type, options)
|
13
|
+
define_method("#{name}=") do |value|
|
14
|
+
value = self.class._attributary_cast_to(type, value) unless self.class._attributary_config.strict_mode?
|
15
|
+
write = true
|
16
|
+
write = self.class._attributary_check_collection(name, value, options[:collection]) if options[:collection].is_a?(Array)
|
17
|
+
write = self.class._attributary_validate_attribute(name, value, options[:validate]) if options[:validate].is_a?(Proc)
|
18
|
+
if options[:validate].is_a?(Symbol)
|
19
|
+
unless send(options[:validate])
|
20
|
+
self.class._attributary_handle_error(name, value, :validation)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
instance_variable_set(:"@#{name}", value) if write
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def _attributary_reader(name, type, options)
|
28
|
+
define_method(name) do
|
29
|
+
instance_variable_get(:"@#{name}") || self.class._attributary_default_for_method(type, options[:default])
|
30
|
+
end
|
31
|
+
if type == :boolean
|
32
|
+
define_method("#{name}?") do
|
33
|
+
send(name.to_s)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def _attributary_default_for_method(type, value)
|
39
|
+
return nil if value.nil?
|
40
|
+
_attributary_cast_to(type, value)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Attributary
|
2
|
+
module DSL
|
3
|
+
module Castings
|
4
|
+
|
5
|
+
def _attributary_cast_to(type, value)
|
6
|
+
cast_klass = _attributary_cast_class(type)
|
7
|
+
cast_klass.cast_to(value)
|
8
|
+
end
|
9
|
+
|
10
|
+
def _attributary_cast_class(type)
|
11
|
+
cast_klass_name = _attributary_cast_class_name(type)
|
12
|
+
cast_klass = cast_klass_name.safe_constantize
|
13
|
+
if cast_klass.nil?
|
14
|
+
raise NameError, "#{cast_klass_name} is not a valid type."
|
15
|
+
end
|
16
|
+
unless cast_klass.respond_to?(:cast_to)
|
17
|
+
raise NoMethodError, "#{cast_klass} should have a class-method of cast_to"
|
18
|
+
end
|
19
|
+
cast_klass
|
20
|
+
end
|
21
|
+
|
22
|
+
def _attributary_cast_class_name(type)
|
23
|
+
"Attributary::Types::#{type.to_s.split('_').map(&:capitalize).join}Type"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Attributary
|
2
|
+
module DSL
|
3
|
+
module Helpers
|
4
|
+
def attributary(&block)
|
5
|
+
block.call(_attributary_config)
|
6
|
+
end
|
7
|
+
|
8
|
+
def _attributary_config
|
9
|
+
@_attributary_config ||= Attributary::Config.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def _attributary_attribute_set
|
13
|
+
@_attributary_attribute_set ||= {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def _attributary_errors
|
17
|
+
@_attributary_errors ||= {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def attributary_errors
|
21
|
+
_attributary_errors
|
22
|
+
end
|
23
|
+
|
24
|
+
def _attributary_attributes
|
25
|
+
hash = {}
|
26
|
+
_attributary_attribute_set.keys.each do |k|
|
27
|
+
hash[k] = instance_variable_get(:"@#{k}")
|
28
|
+
end
|
29
|
+
hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def _attributary_valid?
|
33
|
+
_attributary_errors.empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Attributary
|
2
|
+
module DSL
|
3
|
+
module Validations
|
4
|
+
|
5
|
+
def _attributary_handle_error(attribute, value, type, options = {})
|
6
|
+
message = options[:message] || "#{attribute} value #{value} is invalid."
|
7
|
+
error = _attributary_config.send("#{type}_error")
|
8
|
+
if error.is_a?(Proc)
|
9
|
+
error = error.call(attribute, value)
|
10
|
+
end
|
11
|
+
if quiet_errors?
|
12
|
+
_add_attributary_error(attribute, error.class, message)
|
13
|
+
return
|
14
|
+
end
|
15
|
+
raise error, message
|
16
|
+
end
|
17
|
+
|
18
|
+
def _attributary_check_collection(attribute, value, collection)
|
19
|
+
unless collection.include?(value)
|
20
|
+
_attributary_handle_error(attribute, value, :collection, :message => "Attribute #{attribute} `#{value}' is not in the collection #{collection}")
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def _attributary_validate_attribute(attribute, value, validator)
|
26
|
+
return true if validator.nil?
|
27
|
+
unless validator.call(value)
|
28
|
+
_attributary_handle_error(attribute, value, :validation)
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def _add_attributary_error(name, klass, message)
|
34
|
+
self._attributary_errors[name] = AttributaryError.new(name, klass, message)
|
35
|
+
end
|
36
|
+
|
37
|
+
def quiet_errors?
|
38
|
+
!_attributary_config.raise_errors?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Attributary
|
2
|
+
module Serializer
|
3
|
+
def self.included(base)
|
4
|
+
base.include InstanceMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module InstanceMethods
|
8
|
+
def read_attribute_for_serialization(attribute_name)
|
9
|
+
send(attribute_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def as_json
|
13
|
+
hash = {}
|
14
|
+
self.class._attributary_attribute_set.keys.each do |key|
|
15
|
+
hash[key] = read_attribute_for_serialization(key)
|
16
|
+
end
|
17
|
+
hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/attributary/type.rb
CHANGED
@@ -7,12 +7,3 @@ module Attributary
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
11
|
-
require_relative 'types/array_type'
|
12
|
-
require_relative 'types/big_decimal_type'
|
13
|
-
require_relative 'types/boolean_type'
|
14
|
-
require_relative 'types/float_type'
|
15
|
-
require_relative 'types/hash_type'
|
16
|
-
require_relative 'types/integer_type'
|
17
|
-
require_relative 'types/string_type'
|
18
|
-
require_relative 'types/symbol_type'
|
data/lib/attributary/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attributary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Brody
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.11.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.11.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
41
69
|
description: Like `ActiveModel::Attributes` but less fluffy and more attribute-y.
|
42
70
|
email:
|
43
71
|
- josh@josh.mn
|
@@ -46,7 +74,9 @@ extensions: []
|
|
46
74
|
extra_rdoc_files: []
|
47
75
|
files:
|
48
76
|
- ".gitignore"
|
77
|
+
- ".rspec_status"
|
49
78
|
- Gemfile
|
79
|
+
- LICENSE
|
50
80
|
- README.md
|
51
81
|
- Rakefile
|
52
82
|
- attributary.gemspec
|
@@ -55,10 +85,18 @@ files:
|
|
55
85
|
- lib/.DS_Store
|
56
86
|
- lib/attributary.rb
|
57
87
|
- lib/attributary/.DS_Store
|
88
|
+
- lib/attributary/all.rb
|
58
89
|
- lib/attributary/config.rb
|
59
90
|
- lib/attributary/core_ext.rb
|
60
91
|
- lib/attributary/dsl.rb
|
92
|
+
- lib/attributary/dsl/accessors.rb
|
93
|
+
- lib/attributary/dsl/castings.rb
|
94
|
+
- lib/attributary/dsl/error.rb
|
95
|
+
- lib/attributary/dsl/helpers.rb
|
96
|
+
- lib/attributary/dsl/validations.rb
|
97
|
+
- lib/attributary/errors.rb
|
61
98
|
- lib/attributary/initializer.rb
|
99
|
+
- lib/attributary/serializer.rb
|
62
100
|
- lib/attributary/type.rb
|
63
101
|
- lib/attributary/types/array_type.rb
|
64
102
|
- lib/attributary/types/big_decimal_type.rb
|
@@ -70,7 +108,8 @@ files:
|
|
70
108
|
- lib/attributary/types/symbol_type.rb
|
71
109
|
- lib/attributary/version.rb
|
72
110
|
homepage: https://github.com/joshmn/attributary
|
73
|
-
licenses:
|
111
|
+
licenses:
|
112
|
+
- MIT
|
74
113
|
metadata: {}
|
75
114
|
post_install_message:
|
76
115
|
rdoc_options: []
|