dry-initializer 1.4.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -8
  3. data/.travis.yml +0 -3
  4. data/CHANGELOG.md +339 -196
  5. data/LICENSE.txt +1 -1
  6. data/README.md +3 -3
  7. data/Rakefile +2 -47
  8. data/benchmarks/{several_defaults.rb → compare_several_defaults.rb} +4 -4
  9. data/benchmarks/{without_options.rb → plain_options.rb} +20 -9
  10. data/benchmarks/{params.rb → plain_params.rb} +20 -9
  11. data/benchmarks/{with_types.rb → with_coercion.rb} +20 -9
  12. data/benchmarks/with_defaults.rb +19 -8
  13. data/benchmarks/{with_types_and_defaults.rb → with_defaults_and_coercion.rb} +21 -10
  14. data/dry-initializer.gemspec +3 -3
  15. data/lib/dry/initializer/builders/attribute.rb +76 -0
  16. data/lib/dry/initializer/builders/initializer.rb +61 -0
  17. data/lib/dry/initializer/builders/reader.rb +50 -0
  18. data/lib/dry/initializer/builders/signature.rb +32 -0
  19. data/lib/dry/initializer/builders.rb +7 -0
  20. data/lib/dry/initializer/config.rb +161 -0
  21. data/lib/dry/initializer/definition.rb +93 -0
  22. data/lib/dry/initializer/dsl.rb +43 -0
  23. data/lib/dry/initializer/mixin/local.rb +19 -0
  24. data/lib/dry/initializer/mixin/root.rb +10 -0
  25. data/lib/dry/initializer/mixin.rb +15 -0
  26. data/lib/dry/initializer.rb +45 -41
  27. data/lib/tasks/benchmark.rake +41 -0
  28. data/lib/tasks/profile.rake +78 -0
  29. data/spec/{options_var_spec.rb → attributes_spec.rb} +9 -9
  30. data/spec/custom_initializer_spec.rb +1 -1
  31. data/spec/default_values_spec.rb +6 -6
  32. data/spec/definition_spec.rb +21 -14
  33. data/spec/invalid_default_spec.rb +2 -2
  34. data/spec/missed_default_spec.rb +2 -2
  35. data/spec/optional_spec.rb +2 -2
  36. data/spec/options_tolerance_spec.rb +1 -1
  37. data/spec/public_attributes_utility_spec.rb +22 -0
  38. data/spec/reader_spec.rb +11 -11
  39. data/spec/repetitive_definitions_spec.rb +5 -5
  40. data/spec/several_assignments_spec.rb +1 -1
  41. data/spec/spec_helper.rb +5 -0
  42. data/spec/subclassing_spec.rb +7 -3
  43. data/spec/type_argument_spec.rb +1 -1
  44. data/spec/type_constraint_spec.rb +2 -2
  45. data/spec/value_coercion_via_dry_types_spec.rb +1 -1
  46. metadata +27 -27
  47. data/benchmarks/options.rb +0 -54
  48. data/benchmarks/params_vs_options.rb +0 -35
  49. data/benchmarks/profiler.rb +0 -28
  50. data/lib/dry/initializer/attribute.rb +0 -123
  51. data/lib/dry/initializer/builder.rb +0 -127
  52. data/lib/dry/initializer/class_dsl.rb +0 -37
  53. data/lib/dry/initializer/exceptions/default_value_error.rb +0 -8
  54. data/lib/dry/initializer/exceptions/params_order_error.rb +0 -8
  55. data/lib/dry/initializer/exceptions/type_constraint_error.rb +0 -7
  56. data/lib/dry/initializer/instance_dsl.rb +0 -15
  57. data/lib/dry/initializer/option.rb +0 -61
  58. data/lib/dry/initializer/param.rb +0 -52
  59. data/spec/gem_enhancement_spec.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ceae8e2fd7db0c6573d23b4fc02b3a28c87899b
4
- data.tar.gz: a9535d4a290c5d1fff4172d0a3189e657c408a0a
3
+ metadata.gz: 7d7b2eac100f891f9a301c572c97182eaf78db71
4
+ data.tar.gz: da3d4896fcd9037b02c334f0c9fabec64dc79333
5
5
  SHA512:
6
- metadata.gz: c09a05a65e40b00ad7b1e31fa3bdc0f0960b36cd1a8fca69826ba9ed706e8c16861a627fe12229f86282aa044d7f1aec77bc7b0fd630d6d7daf7e8d15b8bd208
7
- data.tar.gz: 9e956de0414155a0b0350a93641925bc972992aa4f0344bc841cc1c808f7b35129c2844cff14205d05fba6f3045bb8c4b99469ff4fe0450593fb388a261999c8
6
+ metadata.gz: ff805cc5d6808fbba1471b790049388c23f2c555dd7024c145e87e4e550a60310ceb8fe46858d235fc3bc55705c8df97c50ad465e80907c78e318834ce69321d
7
+ data.tar.gz: ef61fe2db0a4d404c39a4b0eb00c779c31dbddb0c4a926be77b7c9f7008c7e6e97c3d877df2161ecaf08ff4bd586ea913a9b3aeb2440d081b5c6cb130bdda66f
data/.rubocop.yml CHANGED
@@ -3,7 +3,9 @@ AllCops:
3
3
  DisplayCopNames: true
4
4
  DisplayStyleGuide: true
5
5
  StyleGuideCopsOnly: true
6
- TargetRubyVersion: 2.2
6
+ TargetRubyVersion: 2.3
7
+ Exclude:
8
+ - lib/tasks/*.rake
7
9
 
8
10
  Bundler/DuplicatedGem:
9
11
  Enabled: false
@@ -29,20 +31,18 @@ Style/FileName:
29
31
 
30
32
  Style/Lambda:
31
33
  Exclude:
32
- - spec/**/*_spec.rb
34
+ - spec/**/*.rb
33
35
 
34
36
  Style/LambdaCall:
35
37
  Enabled: false
36
38
 
37
- Style/RaiseArgs:
38
- EnforcedStyle: compact
39
+ Style/RescueModified:
40
+ Exclude:
41
+ - spec/**/*.rb
39
42
 
40
43
  Style/Semicolon:
41
44
  Exclude:
42
- - spec/**/*_spec.rb
43
-
44
- Style/SignalException:
45
- EnforcedStyle: semantic
45
+ - spec/**/*.rb
46
46
 
47
47
  Style/StringLiterals:
48
48
  EnforcedStyle: double_quotes
data/.travis.yml CHANGED
@@ -6,11 +6,9 @@ bundler_args: --without benchmarks tools
6
6
  script:
7
7
  - bundle exec rake spec
8
8
  rvm:
9
- - 2.2
10
9
  - 2.3.0
11
10
  - 2.4.0
12
11
  - jruby-9000
13
- - rbx-2
14
12
  - rbx-3
15
13
  - ruby-head
16
14
  env:
@@ -18,7 +16,6 @@ env:
18
16
  - JRUBY_OPTS='--dev -J-Xmx1024M'
19
17
  matrix:
20
18
  allow_failures:
21
- - rvm: rbx-2
22
19
  - rvm: rbx-3
23
20
  - rvm: ruby-head
24
21
  - rvm: jruby-head