u-attributes 0.11.0 → 0.12.0
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/.travis.sh +24 -0
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +23 -3
- data/lib/micro/attributes/features.rb +4 -0
- data/lib/micro/attributes/version.rb +1 -1
- data/lib/micro/attributes.rb +5 -2
- data/run-tests.sh +3 -18
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0981953778c6a7130c83e54de1e8c5a992def3ee434b673cfc80c5cb2fb65298'
|
4
|
+
data.tar.gz: 6219cc89e480e32fd28091999b882566aa6374f7e2c9b27a1dffab1881f8ad79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e09afedf86b00b99c76bacc9ace249177259b7ed62e3452bef4b7418f08be6ba75cc1f5c5487015d102b4677f2c9cd23bba9221547dde5f0f600ad47a4a98a45
|
7
|
+
data.tar.gz: b284987930d5092a3158a112d2c6e17f11b6cfb873acdc73023560592c5fcc03e29b331097be49b171c3ac1524895510db14cef1bd7c0d6546801b2f6c0e1350
|
data/.travis.sh
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
bundle exec rake test
|
4
|
+
|
5
|
+
ACTIVEMODEL_VERSION='3.2' bundle update
|
6
|
+
ACTIVEMODEL_VERSION='3.2' bundle exec rake test
|
7
|
+
|
8
|
+
ACTIVEMODEL_VERSION='4.0' bundle update
|
9
|
+
ACTIVEMODEL_VERSION='4.0' bundle exec rake test
|
10
|
+
|
11
|
+
ACTIVEMODEL_VERSION='4.1' bundle update
|
12
|
+
ACTIVEMODEL_VERSION='4.1' bundle exec rake test
|
13
|
+
|
14
|
+
ACTIVEMODEL_VERSION='4.2' bundle update
|
15
|
+
ACTIVEMODEL_VERSION='4.2' bundle exec rake test
|
16
|
+
|
17
|
+
ACTIVEMODEL_VERSION='5.0' bundle update
|
18
|
+
ACTIVEMODEL_VERSION='5.0' bundle exec rake test
|
19
|
+
|
20
|
+
ACTIVEMODEL_VERSION='5.1' bundle update
|
21
|
+
ACTIVEMODEL_VERSION='5.1' bundle exec rake test
|
22
|
+
|
23
|
+
ACTIVEMODEL_VERSION='5.2' bundle update
|
24
|
+
ACTIVEMODEL_VERSION='5.2' bundle exec rake test
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -266,9 +266,7 @@ p Person.new(name: 'John').attributes # {"age"=>nil, "name"=>"John"}
|
|
266
266
|
|
267
267
|
## Built-in extensions
|
268
268
|
|
269
|
-
You can use the method `Micro::Attributes.features()` to combine and require only the features that better fit your needs.
|
270
|
-
|
271
|
-
Note: The method `Micro::Attributes.with()` is an alias for `Micro::Attributes.features()`.
|
269
|
+
You can use the method `Micro::Attributes.features()` or `Micro::Attributes.with()` to combine and require only the features that better fit your needs.
|
272
270
|
|
273
271
|
### Usage
|
274
272
|
|
@@ -276,6 +274,9 @@ Note: The method `Micro::Attributes.with()` is an alias for `Micro::Attributes.f
|
|
276
274
|
#----------------------------------#
|
277
275
|
# Via Micro::Attributes.features() #
|
278
276
|
#----------------------------------#
|
277
|
+
|
278
|
+
# Loading specific features
|
279
|
+
|
279
280
|
class Job
|
280
281
|
include Micro::Attributes.features(:diff)
|
281
282
|
|
@@ -287,6 +288,18 @@ class Job
|
|
287
288
|
end
|
288
289
|
end
|
289
290
|
|
291
|
+
# Loading all features
|
292
|
+
# ---
|
293
|
+
|
294
|
+
class Job
|
295
|
+
include Micro::Attributes.features
|
296
|
+
|
297
|
+
attributes :id, state: 'sleeping'
|
298
|
+
end
|
299
|
+
|
300
|
+
# Note:
|
301
|
+
# If `Micro::Attributes.features()` be invoked without arguments, a module with all features will be returned.
|
302
|
+
|
290
303
|
# --------------------------------------------------------------------#
|
291
304
|
# Using the .with() method alias and adding the initialize extension. #
|
292
305
|
# --------------------------------------------------------------------#
|
@@ -296,6 +309,13 @@ class Job
|
|
296
309
|
attributes :id, state: 'sleeping'
|
297
310
|
end
|
298
311
|
|
312
|
+
# Note:
|
313
|
+
# The method `Micro::Attributes.with()` will raise an exception if no arguments/features were declared.
|
314
|
+
#
|
315
|
+
# class Job
|
316
|
+
# include Micro::Attributes.with() # ArgumentError (Invalid feature name! Available options: diff, initialize, activemodel_validations)
|
317
|
+
# end
|
318
|
+
|
299
319
|
#---------------------------------------#
|
300
320
|
# Via Micro::Attributes.to_initialize() #
|
301
321
|
#---------------------------------------#
|
data/lib/micro/attributes.rb
CHANGED
@@ -29,10 +29,13 @@ module Micro
|
|
29
29
|
features(*options)
|
30
30
|
end
|
31
31
|
|
32
|
-
def self.
|
32
|
+
def self.with(*names)
|
33
33
|
Features.fetch(names)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
|
+
def self.features(*names)
|
37
|
+
names.empty? ? Features.all : Features.fetch(names)
|
38
|
+
end
|
36
39
|
|
37
40
|
def attributes=(arg)
|
38
41
|
self.class.attributes_data(AttributesUtils.hash_argument!(arg)).each do |name, value|
|
data/run-tests.sh
CHANGED
@@ -1,22 +1,7 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
ACTIVEMODEL_VERSION='3.2' bundle exec rake test
|
3
|
+
git checkout -- Gemfile.lock
|
5
4
|
|
6
|
-
|
7
|
-
ACTIVEMODEL_VERSION='4.0' bundle exec rake test
|
5
|
+
source $(dirname $0)/.travis.sh
|
8
6
|
|
9
|
-
|
10
|
-
ACTIVEMODEL_VERSION='4.1' bundle exec rake test
|
11
|
-
|
12
|
-
ACTIVEMODEL_VERSION='4.2' bundle update
|
13
|
-
ACTIVEMODEL_VERSION='4.2' bundle exec rake test
|
14
|
-
|
15
|
-
ACTIVEMODEL_VERSION='5.0' bundle update
|
16
|
-
ACTIVEMODEL_VERSION='5.0' bundle exec rake test
|
17
|
-
|
18
|
-
ACTIVEMODEL_VERSION='5.1' bundle update
|
19
|
-
ACTIVEMODEL_VERSION='5.1' bundle exec rake test
|
20
|
-
|
21
|
-
ACTIVEMODEL_VERSION='5.2' bundle update
|
22
|
-
ACTIVEMODEL_VERSION='5.2' bundle exec rake test
|
7
|
+
git checkout -- Gemfile.lock
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: u-attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Serradura
|
@@ -33,6 +33,7 @@ extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
35
|
- ".gitignore"
|
36
|
+
- ".travis.sh"
|
36
37
|
- ".travis.yml"
|
37
38
|
- CODE_OF_CONDUCT.md
|
38
39
|
- Gemfile
|