dry-initializer 0.11.0 → 2.5.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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +8 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +14 -62
  6. data/.travis.yml +15 -11
  7. data/CHANGELOG.md +538 -158
  8. data/Gemfile +2 -2
  9. data/LICENSE.txt +1 -1
  10. data/README.md +6 -6
  11. data/Rakefile +2 -41
  12. data/benchmarks/{several_defaults.rb → compare_several_defaults.rb} +4 -4
  13. data/benchmarks/{without_options.rb → plain_options.rb} +21 -10
  14. data/benchmarks/{params.rb → plain_params.rb} +20 -9
  15. data/benchmarks/{with_types.rb → with_coercion.rb} +23 -16
  16. data/benchmarks/with_defaults.rb +19 -8
  17. data/benchmarks/{with_types_and_defaults.rb → with_defaults_and_coercion.rb} +21 -12
  18. data/dry-initializer.gemspec +4 -4
  19. data/lib/dry/initializer/builders/attribute.rb +81 -0
  20. data/lib/dry/initializer/builders/initializer.rb +61 -0
  21. data/lib/dry/initializer/builders/reader.rb +50 -0
  22. data/lib/dry/initializer/builders/signature.rb +32 -0
  23. data/lib/dry/initializer/builders.rb +7 -0
  24. data/lib/dry/initializer/config.rb +172 -0
  25. data/lib/dry/initializer/definition.rb +116 -0
  26. data/lib/dry/initializer/dispatchers.rb +44 -0
  27. data/lib/dry/initializer/dsl.rb +43 -0
  28. data/lib/dry/initializer/mixin/local.rb +19 -0
  29. data/lib/dry/initializer/mixin/root.rb +10 -0
  30. data/lib/dry/initializer/mixin.rb +8 -70
  31. data/lib/dry/initializer.rb +49 -12
  32. data/lib/tasks/benchmark.rake +41 -0
  33. data/lib/tasks/profile.rake +78 -0
  34. data/spec/attributes_spec.rb +38 -0
  35. data/spec/coercion_of_nil_spec.rb +25 -0
  36. data/spec/custom_dispatchers_spec.rb +35 -0
  37. data/spec/custom_initializer_spec.rb +1 -1
  38. data/spec/default_values_spec.rb +8 -8
  39. data/spec/definition_spec.rb +107 -0
  40. data/spec/invalid_default_spec.rb +2 -2
  41. data/spec/missed_default_spec.rb +3 -3
  42. data/spec/optional_spec.rb +35 -8
  43. data/spec/options_tolerance_spec.rb +1 -1
  44. data/spec/public_attributes_utility_spec.rb +22 -0
  45. data/spec/reader_spec.rb +11 -11
  46. data/spec/repetitive_definitions_spec.rb +41 -21
  47. data/spec/several_assignments_spec.rb +41 -0
  48. data/spec/spec_helper.rb +7 -0
  49. data/spec/subclassing_spec.rb +7 -3
  50. data/spec/type_argument_spec.rb +1 -1
  51. data/spec/type_constraint_spec.rb +38 -7
  52. data/spec/value_coercion_via_dry_types_spec.rb +12 -4
  53. metadata +37 -40
  54. data/benchmarks/options.rb +0 -54
  55. data/benchmarks/params_vs_options.rb +0 -35
  56. data/lib/dry/initializer/builder.rb +0 -100
  57. data/lib/dry/initializer/errors/default_value_error.rb +0 -6
  58. data/lib/dry/initializer/errors/order_error.rb +0 -7
  59. data/lib/dry/initializer/errors/plugin_error.rb +0 -6
  60. data/lib/dry/initializer/errors/redefinition_error.rb +0 -5
  61. data/lib/dry/initializer/errors/type_constraint_error.rb +0 -5
  62. data/lib/dry/initializer/errors.rb +0 -10
  63. data/lib/dry/initializer/plugins/base.rb +0 -47
  64. data/lib/dry/initializer/plugins/default_proc.rb +0 -28
  65. data/lib/dry/initializer/plugins/signature.rb +0 -28
  66. data/lib/dry/initializer/plugins/type_constraint.rb +0 -21
  67. data/lib/dry/initializer/plugins/variable_setter.rb +0 -30
  68. data/lib/dry/initializer/plugins.rb +0 -10
  69. data/lib/dry/initializer/signature.rb +0 -61
  70. data/spec/base_spec.rb +0 -21
  71. data/spec/container_spec.rb +0 -45
  72. data/spec/default_nil_spec.rb +0 -17
  73. data/spec/plugin_registry_spec.rb +0 -45
  74. data/spec/renaming_options_spec.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 604898d7c7112e84b0e097a2913e81ba54918e25
4
- data.tar.gz: 417c9a1e41b76162b12d7ce36dd19a156ca408e2
3
+ metadata.gz: 861264b64b414e7ff11f68071a530e3208093092
4
+ data.tar.gz: f3426ffd2670dbe47c276d67fd972e86fdeb9677
5
5
  SHA512:
6
- metadata.gz: aec2d5e6f46522584d247e1c106eaab9bcec8b2787c4a827ddb24e1f533c81b242b3c04796207f97c4cb0a179d7581146e94495296f995e31b5a9e0a6c269ccf
7
- data.tar.gz: 0ee2c8d900d400312a8c8ddae17648e1b37d28edb61034a76b0c01e87b2ed740cb135281f391f2e3d3f6170ece71faa977772e463ed5603d8c7a1039d51a0948
6
+ metadata.gz: 3205f5f09066d20a3f05255a71ae8451ec6c00b0c6701bdf2fb4d8a854a61d49d5b1eea952d4cd08d05e3165e8748d73dd1e530a39a12d85bb90e5514bf6c37c
7
+ data.tar.gz: 05205f55be677d470f553ec0e9fcf8d357ffc3ba245c9195b144c24cac478dd3aa2e1e8d6bcbbd6fc1b6b04d92d8e3e8345762bc76838651dab26d90632a31d2
data/.codeclimate.yml CHANGED
@@ -2,6 +2,13 @@
2
2
  engines:
3
3
  rubocop:
4
4
  enabled: true
5
+ checks:
6
+ Rubocop/Style/FrozenStringLiteralComment:
7
+ enabled: false
8
+ Rubocop/Style/PercentLiteralDelimiters:
9
+ enabled: false
10
+ Rubocop/Lint/UnderscorePrefixedVariableName:
11
+ enabled: false
5
12
  duplication:
6
13
  enabled: true
7
14
  config:
@@ -10,6 +17,7 @@ engines:
10
17
  exclude_paths:
11
18
  - "benchmarks/**/*"
12
19
  - "spec/**/*"
20
+ - "lib/tasks/**/*"
13
21
  ratings:
14
22
  paths:
15
23
  - "lib/**/*"
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /*.gem
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
1
  --format documentation
2
2
  --color
3
3
  --require spec_helper
4
+ --warnings
data/.rubocop.yml CHANGED
@@ -3,38 +3,19 @@ AllCops:
3
3
  DisplayCopNames: true
4
4
  DisplayStyleGuide: true
5
5
  StyleGuideCopsOnly: true
6
- TargetRubyVersion: 2.2
7
-
8
- Lint/HandleExceptions:
9
- Exclude:
10
- - spec/**/*_spec.rb
11
-
12
- Lint/RescueException:
13
- Exclude:
14
- - spec/**/*_spec.rb
15
-
16
- Metrics/LineLength:
17
- Max: 80
18
- Exclude:
19
- - spec/**/*_spec.rb
20
-
21
- Style/AccessorMethodName:
6
+ TargetRubyVersion: 2.3
22
7
  Exclude:
23
- - spec/**/*_spec.rb
24
-
25
- Style/Alias:
26
- EnforcedStyle: prefer_alias_method
8
+ - lib/tasks/*.rake
27
9
 
28
- Style/AsciiComments:
10
+ Bundler/DuplicatedGem:
29
11
  Enabled: false
30
12
 
31
- Style/BlockDelimiters:
32
- Exclude:
33
- - spec/**/*_spec.rb
34
-
35
13
  Style/CaseEquality:
36
14
  Enabled: false
37
15
 
16
+ Style/ClassVars:
17
+ Enabled: false
18
+
38
19
  Style/ClassAndModuleChildren:
39
20
  Enabled: false
40
21
 
@@ -44,56 +25,27 @@ Style/Documentation:
44
25
  Style/DoubleNegation:
45
26
  Enabled: false
46
27
 
47
- Style/EmptyLinesAroundClassBody:
48
- Enabled: false
49
-
50
- Style/EmptyLinesAroundModuleBody:
51
- Enabled: false
52
-
53
- Style/EmptyLineBetweenDefs:
54
- Enabled: false
55
-
56
28
  Style/FileName:
57
- Enabled: false
58
-
59
- Style/Lambda:
60
29
  Exclude:
61
- - spec/**/*_spec.rb
62
-
63
- Style/ModuleFunction:
64
- Enabled: false
65
-
66
- Style/RaiseArgs:
67
- EnforcedStyle: compact
30
+ - lib/dry-initializer.rb
68
31
 
69
- Style/Semicolon:
32
+ Style/Lambda:
70
33
  Exclude:
71
- - spec/**/*_spec.rb
34
+ - spec/**/*.rb
72
35
 
73
- Style/SignalException:
74
- EnforcedStyle: semantic
75
-
76
- Style/SingleLineBlockParams:
36
+ Style/LambdaCall:
77
37
  Enabled: false
78
38
 
79
- Style/SingleLineMethods:
39
+ Style/RescueModified:
80
40
  Exclude:
81
- - spec/**/*_spec.rb
82
-
83
- Style/SpaceBeforeFirstArg:
84
- Enabled: false
41
+ - spec/**/*.rb
85
42
 
86
- Style/SpecialGlobalVars:
43
+ Style/Semicolon:
87
44
  Exclude:
88
- - Gemfile
89
- - dry-initializer.gemspec
45
+ - spec/**/*.rb
90
46
 
91
47
  Style/StringLiterals:
92
48
  EnforcedStyle: double_quotes
93
49
 
94
50
  Style/StringLiteralsInInterpolation:
95
51
  EnforcedStyle: double_quotes
96
-
97
- Style/TrivialAccessors:
98
- Exclude:
99
- - spec/**/*_spec.rb
data/.travis.yml CHANGED
@@ -1,20 +1,24 @@
1
1
  ---
2
- sudo: false
3
2
  language: ruby
4
- cache: bundler
3
+ sudo: false
4
+ cache: bundler
5
+ bundler_args: --without benchmarks tools
5
6
  script:
6
- - bundle exec rspec
7
- - bundle exec rubocop
7
+ - bundle exec rake spec
8
8
  rvm:
9
- - '2.2'
10
- - '2.3.0'
11
- - '2.4.0'
12
- # - rbx-2
9
+ - 2.3.0
10
+ - 2.4.0
11
+ - jruby-9000
12
+ - rbx-3
13
13
  - ruby-head
14
- - jruby-9.1.0.0
15
- - jruby-head
16
- before_install: gem install bundler -v 1.12.5
14
+ env:
15
+ global:
16
+ - JRUBY_OPTS='--dev -J-Xmx1024M'
17
17
  matrix:
18
18
  allow_failures:
19
+ - rvm: rbx-3
19
20
  - rvm: ruby-head
20
21
  - rvm: jruby-head
22
+ include:
23
+ - rvm: jruby-head
24
+ before_install: gem install bundler --no-ri --no-rdoc