dsl_compose 2.8.0 → 2.10.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/lib/dsl_compose/parser.rb +12 -15
  4. data/lib/dsl_compose/reader/execution_reader/arguments_reader.rb +5 -0
  5. data/lib/dsl_compose/version.rb +1 -1
  6. data/sig/dsl_compose/class_coerce.rbs +14 -0
  7. data/sig/dsl_compose/composer.rbs +20 -0
  8. data/sig/dsl_compose/dsl/arguments/argument/end_with_validation.rbs +21 -0
  9. data/sig/dsl_compose/dsl/arguments/argument/equal_to_validation.rbs +20 -0
  10. data/sig/dsl_compose/dsl/arguments/argument/format_validation.rbs +22 -0
  11. data/sig/dsl_compose/dsl/arguments/argument/greater_than_or_equal_to_validation.rbs +22 -0
  12. data/sig/dsl_compose/dsl/arguments/argument/greater_than_validation.rbs +22 -0
  13. data/sig/dsl_compose/dsl/arguments/argument/in_validation.rbs +22 -0
  14. data/sig/dsl_compose/dsl/arguments/argument/interpreter.rbs +32 -0
  15. data/sig/dsl_compose/dsl/arguments/argument/is_a_validation.rbs +18 -0
  16. data/sig/dsl_compose/dsl/arguments/argument/length_validation.rbs +21 -0
  17. data/sig/dsl_compose/dsl/arguments/argument/less_than_or_equal_to_validation.rbs +21 -0
  18. data/sig/dsl_compose/dsl/arguments/argument/less_than_validation.rbs +21 -0
  19. data/sig/dsl_compose/dsl/arguments/argument/not_end_with_validation.rbs +21 -0
  20. data/sig/dsl_compose/dsl/arguments/argument/not_in_validation.rbs +21 -0
  21. data/sig/dsl_compose/dsl/arguments/argument/not_start_with_validation.rbs +21 -0
  22. data/sig/dsl_compose/dsl/arguments/argument/start_with_validation.rbs +21 -0
  23. data/sig/dsl_compose/dsl/arguments/argument.rbs +78 -0
  24. data/sig/dsl_compose/dsl/arguments.rbs +33 -0
  25. data/sig/dsl_compose/dsl/dsl_method/interpreter.rbs +18 -0
  26. data/sig/dsl_compose/dsl/dsl_method.rbs +47 -0
  27. data/sig/dsl_compose/dsl/interpreter.rbs +20 -0
  28. data/sig/dsl_compose/dsl.rbs +57 -0
  29. data/sig/dsl_compose/dsls.rbs +22 -0
  30. data/sig/dsl_compose/interpreter/execution/arguments.rbs +28 -0
  31. data/sig/dsl_compose/interpreter/execution/method_calls/method_call.rbs +26 -0
  32. data/sig/dsl_compose/interpreter/execution/method_calls.rbs +16 -0
  33. data/sig/dsl_compose/interpreter/execution.rbs +28 -0
  34. data/sig/dsl_compose/interpreter.rbs +21 -0
  35. data/sig/dsl_compose/parser/block_arguments.rbs +8 -0
  36. data/sig/dsl_compose/parser/for_children_of_parser/descendents.rbs +17 -0
  37. data/sig/dsl_compose/parser/for_children_of_parser/for_dsl_parser/for_method_parser.rbs +37 -0
  38. data/sig/dsl_compose/parser/for_children_of_parser/for_dsl_parser.rbs +36 -0
  39. data/sig/dsl_compose/parser/for_children_of_parser.rbs +32 -0
  40. data/sig/dsl_compose/parser.rbs +12 -0
  41. data/sig/dsl_compose/reader/execution_reader/arguments_reader.rbs +16 -0
  42. data/sig/dsl_compose/reader/execution_reader.rbs +17 -0
  43. data/sig/dsl_compose/reader.rbs +22 -0
  44. data/sig/dsl_compose/reader_base.rbs +17 -0
  45. data/sig/dsl_compose/shared_configuration.rbs +22 -0
  46. data/sig/dsl_compose.rbs +4 -0
  47. metadata +43 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6fea0a926ea88fad5e75633a95629a75105580958b512baae3362c47aa2384c
4
- data.tar.gz: '03486a86365c848b0815d768eb7de00478bebeb8b87d9412a4b06db67857ebcd'
3
+ metadata.gz: f1a63126e260fbca1433946b983adcc053c1d457f0356114bd8a8a07cd347399
4
+ data.tar.gz: 633636a2d3935493452b3b594bb87f27cba96bfe383be8d3948905a1c56b26a9
5
5
  SHA512:
6
- metadata.gz: 550d159aca95511d2409fb085ba865f9230ac67fb29ddece4e2f7bbfcf054033e8ce598d6f2ff00d088c27a266c14fdaf1f4405808a6a99fe7ed6888bfeef6a8
7
- data.tar.gz: 69c5444f0064dbe31a3da9be2a0712fc419758d3ca661ecf70a22429e80d4581e451a1840a28a7fc2d44902b183d20dc9069036d0f062ad78465de6c58a86a4c
6
+ metadata.gz: de52f063d8fd04e95e8c389cd91f95c6fc2fb7e346a56fae7ee5f433385c52499412a37d7197c9f60c2886f4f7f194c57b0f0b93232a6993c1fe7c8f4e0fbe61
7
+ data.tar.gz: 6e66853fb176c9de01f637e83f83536a3a59872175a9ce13a1aeafcfd004f012d27dc6b83068db6fb8a72a69b76d2a1fed6bf93a9fb9cd4a3d8f7129912ad868
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.10.0](https://github.com/craigulliott/dsl_compose/compare/v2.9.0...v2.10.0) (2023-09-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * adding a `has_argument?` method to the DSL reader base class ([4a5db6a](https://github.com/craigulliott/dsl_compose/commit/4a5db6ab258283960fc909bdf46c75837475aa59))
9
+
10
+ ## [2.9.0](https://github.com/craigulliott/dsl_compose/compare/v2.8.0...v2.9.0) (2023-08-31)
11
+
12
+
13
+ ### Features
14
+
15
+ * adding rbs signatures to built gem so they are available in other projects ([1733e11](https://github.com/craigulliott/dsl_compose/commit/1733e1103921fd6724cf994ce430ef0f2a1f7806))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * improving the rerun_all method so that the list of parsers to rerun does not depend on a parser having previously executed it's for_children_of method ([679d896](https://github.com/craigulliott/dsl_compose/commit/679d896c3efb2c5808b99f7fb996ca66f17d541d))
21
+
3
22
  ## [2.8.0](https://github.com/craigulliott/dsl_compose/compare/v2.7.0...v2.8.0) (2023-08-31)
4
23
 
5
24
 
@@ -32,17 +32,12 @@ module DSLCompose
32
32
  # children of their own)
33
33
  def self.for_children_of base_class, final_children_only: false, rerun: false, &block
34
34
  unless rerun
35
- run = {
35
+ @runs ||= []
36
+ @runs << {
36
37
  base_class: base_class,
37
38
  final_children_only: final_children_only,
38
39
  block: block
39
40
  }
40
-
41
- @@all_runs ||= []
42
- @@all_runs << run
43
-
44
- @runs ||= []
45
- @runs << run
46
41
  end
47
42
 
48
43
  # we parse the provided block in the context of the ForChildrenOfParser class
@@ -59,7 +54,7 @@ module DSLCompose
59
54
  end
60
55
 
61
56
  # this method is used to rerun the parser, this is most useful from within a test suite
62
- # when you are testing the parser itself
57
+ # when you are testing the parser or the effects of running the parser
63
58
  def self.rerun
64
59
  # rerun each parser for this specific class
65
60
  @runs&.each do |run|
@@ -70,15 +65,17 @@ module DSLCompose
70
65
  end
71
66
  end
72
67
 
68
+ # so we know which parsers have run, and in which order
69
+ def self.inherited subclass
70
+ @@all_parser_classes ||= []
71
+ @@all_parser_classes << subclass
72
+ end
73
+
73
74
  # this method is used to rerun all of the parsers, this is most useful from within a test suite
74
- # when you are testing the parser itself
75
+ # when you are testing the parser or the effects of running the parser
75
76
  def self.rerun_all
76
- # rerun each parser for all classes (call this method directly on the parser object `DSLCompose::Parser.rerun_all`)
77
- @all_runs&.each do |run|
78
- base_class = run[:base_class]
79
- block = run[:block]
80
- final_children_only = run[:final_children_only]
81
- for_children_of base_class, rerun: true, final_children_only: final_children_only, &block
77
+ @@all_parser_classes.each do |parser_class|
78
+ parser_class.rerun
82
79
  end
83
80
  end
84
81
  end
@@ -27,6 +27,11 @@ module DSLCompose
27
27
  @argument_values.arguments[argument.name]
28
28
  end
29
29
 
30
+ # returns true if the DSL has an argument with the provided name
31
+ def has_argument? argument_name
32
+ @arguments.has_argument? argument_name
33
+ end
34
+
30
35
  def respond_to_missing? method_name
31
36
  @arguments.has_argument? method_name
32
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSLCompose
4
- VERSION = "2.8.0"
4
+ VERSION = "2.10.0"
5
5
  end
@@ -0,0 +1,14 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class ClassCoerce
4
+ @class_name: String
5
+
6
+ def initialize: (String class_name) -> void
7
+ def to_class: -> untyped
8
+
9
+
10
+ class UnexpectedClassNameError < StandardError
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ # Classes
2
+ module DSLCompose
3
+ module Composer
4
+ def self.included: (untyped klass) -> untyped
5
+
6
+ def self.get_dsl: (Symbol name) -> DSL
7
+
8
+ def self.define_dsl: (Symbol name) -> void
9
+
10
+ class ComposerAlreadyInstalledError < StandardError
11
+ end
12
+
13
+ class MethodAlreadyExistsWithThisDSLNameError < StandardError
14
+ end
15
+
16
+ class GetDSLExecutionResultsMethodAlreadyExistsError < StandardError
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class EndWithValidation
7
+ @values: Array[Symbol]
8
+
9
+ def initialize: (Symbol | Array[Symbol]) -> void
10
+ def validate!: (Symbol | String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class EqualToValidation
7
+ @value: Numeric | String | Symbol | bool
8
+
9
+ def initialize: (Numeric | String | Symbol | bool value) -> void
10
+ def validate!: (Numeric | String | Symbol | bool value) -> true
11
+
12
+
13
+ class ValidationFailedError < StandardError
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class FormatValidation
7
+ @regex: Regexp
8
+
9
+ def initialize: (Regexp regex) -> void
10
+ def validate!: (String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class GreaterThanOrEqualToValidation
7
+ @value: Numeric
8
+
9
+ def initialize: (Numeric value) -> void
10
+ def validate!: (Numeric value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class GreaterThanValidation
7
+ @value: Numeric
8
+
9
+ def initialize: (Numeric value) -> void
10
+ def validate!: (Numeric value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class InValidation
7
+ @values: Array[Numeric | Symbol | String]
8
+
9
+ def initialize: (Array[Numeric | Symbol | String] values) -> void
10
+ def validate!: (Numeric | Symbol | String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class Interpreter
7
+ @argument: Argument
8
+
9
+ def initialize: (Argument argument) -> void
10
+ def instance_eval: () -> void
11
+
12
+ private
13
+ def description: (String description) -> void
14
+ def validate_greater_than: (Numeric value) -> void
15
+ def validate_greater_than_or_equal_to: (Numeric value) -> void
16
+ def validate_less_than: (Numeric value) -> void
17
+ def validate_less_than_or_equal_to: (Numeric value) -> void
18
+ def validate_equal_to: (Numeric value) -> void
19
+ def validate_length: (?minimum: Numeric?, ?maximum: Numeric?, ?is: Numeric?) -> void
20
+ def validate_not_in: ([Numeric | Symbol | String] values) -> void
21
+ def validate_in: ([Numeric | Symbol | String] values) -> void
22
+ def validate_end_with: (Symbol | Array[Symbol] value) -> void
23
+ def validate_not_end_with: (Symbol | Array[Symbol] value) -> void
24
+ def validate_start_with: (Symbol | Array[Symbol] value) -> void
25
+ def validate_not_start_with: (Symbol | Array[Symbol] value) -> void
26
+ def validate_format: (Regexp regex) -> void
27
+ def validate_is_a: (String class_name) -> void
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,18 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class IsAValidation
7
+ @value: Object
8
+
9
+ def initialize: (Object value) -> void
10
+ def validate!: (untyped value) -> true
11
+
12
+ class ValidationFailedError < StandardError
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class LengthValidation
7
+ @maximum: nil | Numeric
8
+ @minimum: nil | Numeric
9
+ @is: nil | Numeric
10
+
11
+ def initialize: (?maximum: nil | Numeric, ?minimum: nil | Numeric, ?is: nil | Numeric) -> void
12
+ def validate!: (String | Symbol value) -> true
13
+
14
+ class ValidationFailedError < StandardError
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class LessThanOrEqualToValidation
7
+ @value: Numeric
8
+
9
+ def initialize: (Numeric value) -> void
10
+ def validate!: (Numeric value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class LessThanValidation
7
+ @value: Numeric
8
+
9
+ def initialize: (Numeric value) -> void
10
+ def validate!: (Numeric value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class NotEndWithValidation
7
+ @values: Array[Symbol]
8
+
9
+ def initialize: (Symbol | Array[Symbol]) -> void
10
+ def validate!: (Symbol | String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class NotInValidation
7
+ @values: Array[Numeric | Symbol | String]
8
+
9
+ def initialize: (Array[Numeric | Symbol | String] values) -> void
10
+ def validate!: (Numeric | Symbol | String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class NotStartWithValidation
7
+ @values: Array[Symbol]
8
+
9
+ def initialize: (Symbol | Array[Symbol]) -> void
10
+ def validate!: (Symbol | String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ class Argument
6
+ class StartWithValidation
7
+ @values: Array[Symbol]
8
+
9
+ def initialize: (Symbol | Array[Symbol]) -> void
10
+ def validate!: (Symbol | String value) -> true
11
+
12
+ class InvalidValueError < StandardError
13
+ end
14
+
15
+ class ValidationFailedError < StandardError
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,78 @@
1
+ type argument_type = :integer | :string | :boolean | :float | :array | :symbol | :class | :object
2
+ # Classes
3
+ module DSLCompose
4
+ class DSL
5
+ class Arguments
6
+ class Argument
7
+ RESERVED_ARGUMENT_NAMES: Array[Symbol]
8
+
9
+ attr_reader name: Symbol
10
+ attr_reader type: argument_type
11
+ attr_reader required: bool
12
+ attr_reader array: bool
13
+ attr_reader description: String
14
+
15
+ attr_reader greater_than_validation: GreaterThanValidation
16
+ attr_reader greater_than_or_equal_to_validation: GreaterThanOrEqualToValidation
17
+ attr_reader less_than_validation: LessThanValidation
18
+ attr_reader less_than_or_equal_to_validation: LessThanOrEqualToValidation
19
+ attr_reader format_validation: FormatValidation
20
+ attr_reader equal_to_validation: EqualToValidation
21
+ attr_reader in_validation: InValidation
22
+ attr_reader not_in_validation: NotInValidation
23
+ attr_reader end_with_validation: EndWithValidation
24
+ attr_reader not_end_with_validation: NotEndWithValidation
25
+ attr_reader start_with_validation: StartWithValidation
26
+ attr_reader not_start_with_validation: NotStartWithValidation
27
+ attr_reader length_validation: LengthValidation
28
+ attr_reader is_a_validation: IsAValidation
29
+
30
+ def initialize: (Symbol name, bool required, argument_type `type`, ?array: bool) -> void
31
+ def set_description: (String description) -> void
32
+ def has_description?: () -> bool
33
+ def required?: -> bool
34
+ def optional?: -> bool
35
+
36
+ def validate_greater_than: (Numeric value) -> void
37
+ def validate_greater_than_or_equal_to: (Numeric value) -> void
38
+ def validate_less_than: (Numeric value) -> void
39
+ def validate_less_than_or_equal_to: (Numeric value) -> void
40
+ def validate_format: (Regexp regexp) -> void
41
+ def validate_equal_to: (Numeric | Symbol | String value) -> void
42
+ def validate_in: (Array[Numeric | Symbol | String] values) -> void
43
+ def validate_not_in: (Array[Numeric | Symbol | String] values) -> void
44
+ def validate_end_with: (Symbol | Array[Symbol] value) -> void
45
+ def validate_not_end_with: (Symbol | Array[Symbol] value) -> void
46
+ def validate_start_with: (Symbol | Array[Symbol] value) -> void
47
+ def validate_not_start_with: (Symbol | Array[Symbol] value) -> void
48
+ def validate_length: (?maximum: nil | Numeric, ?minimum: nil | Numeric, ?is: nil | Numeric) -> void
49
+ def validate_is_a: (String class_name) -> void
50
+
51
+ class ValidationInvalidArgumentError < StandardError
52
+ end
53
+
54
+ class ValidationIncompatibleError < StandardError
55
+ def message: -> untyped
56
+ end
57
+
58
+ class ValidationAlreadyExistsError < StandardError
59
+ end
60
+
61
+ class InvalidTypeError < StandardError
62
+ end
63
+
64
+ class ArgumentNameReservedError < StandardError
65
+ end
66
+
67
+ class InvalidNameError < StandardError
68
+ end
69
+
70
+ class InvalidDescriptionError < StandardError
71
+ end
72
+
73
+ class DescriptionAlreadyExistsError < StandardError
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,33 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Arguments
5
+ @arguments: Hash[Symbol, Argument]
6
+
7
+ def initialize: -> void
8
+ def arguments: -> Array[Argument]
9
+ def optional_arguments: -> Array[Argument]
10
+ def required_arguments: -> Array[Argument]
11
+ def argument: (Symbol name) -> Argument
12
+ def optional_argument: (Symbol name) -> Argument
13
+ def required_argument: (Symbol name) -> Argument
14
+ def has_argument?: (Symbol name) -> bool
15
+ def add_argument: (Symbol name, bool required, argument_type `type`, ?array: bool) -> Argument
16
+
17
+ class ArgumentDoesNotExistError < StandardError
18
+ end
19
+
20
+ class ArgumentOrderingError < StandardError
21
+ end
22
+
23
+ class ArgumentAlreadyExistsError < StandardError
24
+ end
25
+
26
+ class RequestedOptionalArgumentIsRequiredError < StandardError
27
+ end
28
+
29
+ class RequestedRequiredArgumentIsOptionalError < StandardError
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class DSLMethod
5
+ class Interpreter
6
+ @dsl_method: DSLMethod
7
+
8
+ def initialize: (DSLMethod dsl_method) -> void
9
+ def instance_eval: () -> void
10
+
11
+ private
12
+ def description: (String description) -> void
13
+ def optional: (Symbol name, argument_type `type`, ?array: bool) -> void
14
+ def requires: (Symbol name, argument_type `type`, ?array: bool) -> void
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,47 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class DSLMethod
5
+
6
+ attr_reader name: Symbol
7
+ attr_reader unique: bool
8
+ attr_reader required: bool
9
+ attr_reader description: String
10
+ attr_reader arguments: Arguments
11
+
12
+ def initialize: (Symbol name, bool unique, bool required) -> void
13
+ def set_description: (String description) -> void
14
+ def has_description?: -> bool
15
+ def unique?: -> bool
16
+ def required?: -> bool
17
+ def optional?: -> bool
18
+
19
+ class ArgumentDoesNotExistError < StandardError
20
+ end
21
+
22
+ class InvalidNameError < StandardError
23
+ end
24
+
25
+ class MethodNameIsReservedError < StandardError
26
+ end
27
+
28
+ class InvalidDescriptionError < StandardError
29
+ end
30
+
31
+ class DescriptionAlreadyExistsError < StandardError
32
+ end
33
+
34
+ class ArgumentOrderingError < StandardError
35
+ end
36
+
37
+ class ArgumentAlreadyExistsError < StandardError
38
+ end
39
+
40
+ class RequestedOptionalArgumentIsRequiredError < StandardError
41
+ end
42
+
43
+ class RequestedRequiredArgumentIsOptionalError < StandardError
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,20 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ class Interpreter
5
+ @dsl: DSL
6
+
7
+ def initialize: (DSL dsl) -> void
8
+ def instance_eval: () -> void
9
+
10
+ private
11
+ def description: (String description) -> void
12
+ def namespace: (Symbol namespace) -> void
13
+ def title: (String title) -> void
14
+ def add_method: (Symbol name, ?required: nil) -> void
15
+ def add_unique_method: (Symbol name, ?required: nil) -> void
16
+ def optional: (Symbol name, argument_type `type`, ?array: bool) -> void
17
+ def requires: (Symbol name, argument_type `type`, ?array: bool) -> void
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,57 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class DSL
4
+ @dsl_methods: Hash[Symbol, DSLMethod]
5
+
6
+ attr_reader name: Symbol
7
+ attr_reader arguments: Arguments
8
+ attr_reader klass: Object
9
+ attr_reader description: String
10
+ attr_reader namespace: Symbol
11
+ attr_reader title: String
12
+ def initialize: (Symbol name, Object klass) -> void
13
+ def evaluate_configuration_block: () -> void
14
+ def set_description: (String description) -> String
15
+ def has_description?: -> bool
16
+ def set_namespace: (Symbol namespace) -> Symbol
17
+ def has_namespace?: -> bool
18
+ def set_title: (String title) -> String
19
+ def has_title?: -> bool
20
+ def add_method: (Symbol name, bool unique, bool required) -> DSLMethod
21
+ def dsl_methods: -> Array[DSLMethod]
22
+ def required_dsl_methods: -> Array[DSLMethod]
23
+ def optional_dsl_methods: -> Array[DSLMethod]
24
+ def dsl_method: (Symbol name) -> DSLMethod
25
+ def has_dsl_method?: (Symbol name) -> bool
26
+
27
+ class MethodDoesNotExistError < StandardError
28
+ end
29
+
30
+ class MethodAlreadyExistsError < StandardError
31
+ end
32
+
33
+ class InvalidNameError < StandardError
34
+ end
35
+
36
+ class NoBlockProvidedError < StandardError
37
+ end
38
+
39
+ class InvalidDescriptionError < StandardError
40
+ end
41
+
42
+ class DescriptionAlreadyExistsError < StandardError
43
+ end
44
+
45
+ class InvalidNamespaceError < StandardError
46
+ end
47
+
48
+ class NamespaceAlreadyExistsError < StandardError
49
+ end
50
+
51
+ class InvalidTitleError < StandardError
52
+ end
53
+
54
+ class TitleAlreadyExistsError < StandardError
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ module DSLs
4
+ self.@dsls: Hash[Object, Hash[Symbol, DSL]]
5
+
6
+ def self.create_dsl: (Object klass, Symbol name) -> DSL
7
+ def self.class_dsl_exists?: (Object klass, Symbol name) -> bool
8
+ def self.dsls: -> Hash[Object, Hash[Symbol, DSL]]
9
+ def self.class_dsls: (Object klass) -> Array[DSL]
10
+ def self.class_dsl: (Object klass, Symbol name) -> DSL
11
+ def self.reset: -> void
12
+
13
+ class ClassDSLDefinitionDoesNotExistError < StandardError
14
+ end
15
+
16
+ class DSLAlreadyExistsError < StandardError
17
+ end
18
+
19
+ class NoDSLDefinitionsForClassError < StandardError
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Interpreter
4
+ class Execution
5
+ class Arguments
6
+ attr_reader arguments: Hash[untyped, untyped]
7
+ def initialize: (untyped arguments, *untyped args) -> void
8
+ def to_h: -> Hash[untyped, untyped]
9
+
10
+ class MissingRequiredArgumentsError < StandardError
11
+ def initialize: (untyped required_count, untyped provided_count) -> void
12
+ end
13
+
14
+ class TooManyArgumentsError < StandardError
15
+ end
16
+
17
+ class OptionalArgumentsShouldBeHashError < StandardError
18
+ end
19
+
20
+ class InvalidArgumentTypeError < StandardError
21
+ end
22
+
23
+ class ArrayNotValidError < StandardError
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Interpreter
4
+ class Execution
5
+ class MethodCalls
6
+ class MethodCall
7
+ class InvalidDescriptionError < StandardError
8
+ end
9
+
10
+ @method_call: MethodCall
11
+ @parser_usage_notes: Array[String]
12
+
13
+ attr_reader dsl_method: DSL::DSLMethod
14
+ attr_reader arguments: Arguments
15
+
16
+ def initialize: (DSL::DSLMethod dsl_method, *untyped args) -> void
17
+ def method_name: -> Symbol
18
+ def add_parser_usage_note: (String note) -> void
19
+ def parser_usage_notes: () -> Array[String]
20
+
21
+ def to_h: -> Hash[untyped, untyped]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Interpreter
4
+ class Execution
5
+ class MethodCalls
6
+ @method_calls: Array[MethodCall]
7
+
8
+ def initialize: -> void
9
+ def method_calls: () -> Array[MethodCall]
10
+ def method_called?: (Symbol method_name) -> bool
11
+ def method_calls_by_name: (Symbol method_name) -> Array[MethodCall]
12
+ def add_method_call: (DSL::DSLMethod dsl_method, *untyped args) -> MethodCall
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Interpreter
4
+ class Execution
5
+ @parser_usage_notes: Array[String]
6
+
7
+ attr_reader dsl: DSL
8
+ attr_reader klass: Object
9
+ attr_reader method_calls: MethodCalls
10
+ attr_reader arguments: Arguments
11
+
12
+ def initialize: (Object klass, DSL dsl, *untyped args) -> void
13
+ def instance_eval: () -> void
14
+ def add_parser_usage_note: (String note) -> void
15
+ def parser_usage_notes: () -> Array[String]
16
+
17
+ private
18
+ def method_missing: (Symbol method_name, *untyped args) -> untyped
19
+ def respond_to_missing?: (Symbol method_name, *untyped args) -> untyped
20
+
21
+ class MethodIsUniqueError < StandardError
22
+ end
23
+
24
+ class RequiredMethodNotCalledError < StandardError
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Interpreter
4
+ @parser_usage_notes: Hash[singleton(Object), Array[String]]
5
+ attr_reader executions: Array[Execution]
6
+ def initialize: -> void
7
+ def execute_dsl: (untyped klass, DSL dsl, *untyped args) -> Execution
8
+ def class_executions: (singleton(Object) klass) -> Array[Execution]
9
+ def dsl_executions: (Symbol dsl_name) -> Array[Execution]
10
+ def to_h: (Symbol dsl_name) -> Hash[Symbol, Hash[Symbol, Array[Hash[Symbol, Symbol]]]]
11
+ def executions_by_class: () -> Hash[Symbol, Hash[Symbol, Array[Hash[Symbol, Symbol]]]]
12
+ def add_parser_usage_note: (singleton(Object) klass, String note) -> void
13
+ def parser_usage_notes: (singleton(Object) klass) -> Array[String]
14
+
15
+ class InvalidDescriptionError < StandardError
16
+ end
17
+
18
+ class DSLExecutionNotFoundError < StandardError
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Parser
4
+ class BlockArguments
5
+ def self.accepts_argument?: (Symbol arg_name) -> bool
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Parser
4
+ class ForChildrenOfParser
5
+ class Descendents
6
+ @base_class: singleton(Object)
7
+ @final_children_only: bool
8
+
9
+ def initialize: (singleton(Object) base_class, bool final_children_only) -> void
10
+ def classes: -> Array[singleton(Object)]
11
+
12
+ private
13
+ def has_descendents: (singleton(Object) base_class) -> bool
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Parser
4
+ class ForChildrenOfParser
5
+ class ForDSLParser
6
+ class ForMethodParser
7
+ @base_class: singleton(Object)
8
+ @child_class: singleton(Object)
9
+ @dsl_execution: Interpreter::Execution
10
+ @method_names: Array[Symbol]
11
+ @method_name: Symbol
12
+ @method_call: Interpreter::Execution::MethodCalls::MethodCall
13
+
14
+ def initialize: (singleton(Object) base_class, singleton(Object) child_class, Interpreter::Execution dsl_execution, Array[Symbol] method_names) -> void
15
+
16
+ # overriding this method because steep doesn't
17
+ # correctly infer that a block is being passed to this method
18
+ def instance_exec: (
19
+ ::Hash[untyped, untyped] args
20
+ ) -> void
21
+
22
+ class AllBlockParametersMustBeKeywordParametersError < StandardError
23
+ end
24
+
25
+ class NoBlockProvided < StandardError
26
+ end
27
+
28
+ class MethodDoesNotExistError < StandardError
29
+ end
30
+
31
+ class MethodNamesShouldBeSymbolsError < StandardError
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Parser
4
+ class ForChildrenOfParser
5
+ class ForDSLParser
6
+ @base_class: singleton(Object)
7
+ @child_class: singleton(Object)
8
+ @dsl_names: Array[Symbol]
9
+ @dsl_execution: Interpreter::Execution
10
+
11
+ def initialize: (singleton(Object) base_class, singleton(Object) child_class, Array[Symbol] dsl_names, bool on_current_class, bool on_ancestor_class) -> void
12
+
13
+ # overriding this method because steep doesn't
14
+ # correctly infer that a block is being passed to this method
15
+ def instance_exec: (
16
+ ::Hash[untyped, untyped] args
17
+ ) -> void
18
+
19
+ private
20
+ def for_method: (Array[Symbol] method_names) -> void
21
+
22
+ class AllBlockParametersMustBeKeywordParametersError < StandardError
23
+ end
24
+
25
+ class NoBlockProvided < StandardError
26
+ end
27
+
28
+ class DSLDoesNotExistError < StandardError
29
+ end
30
+
31
+ class DSLNamesShouldBeSymbolsError < StandardError
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,32 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Parser
4
+ class ForChildrenOfParser
5
+ @base_class: singleton(Object)
6
+ @child_class: singleton(Object)
7
+
8
+ def initialize: (singleton(Object) base_class, bool final_children_only) -> void
9
+
10
+ # overriding this method because steep doesn't
11
+ # correctly infer that a block is being passed to this method
12
+ def instance_exec: (
13
+ ::Hash[untyped, untyped] args
14
+ ) -> void
15
+
16
+ private
17
+ def for_dsl: (Array[Symbol] dsl_names, ?on_current_class: bool, ?on_ancestor_class: bool) -> untyped
18
+
19
+ class AllBlockParametersMustBeKeywordParametersError < StandardError
20
+ end
21
+
22
+ class ClassDoesNotUseDSLComposeError < StandardError
23
+ end
24
+
25
+ class NoBlockProvided < StandardError
26
+ end
27
+
28
+ class NoChildClassError < StandardError
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,12 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Parser
4
+ self.@runs: untyped
5
+
6
+ def initialize: -> void
7
+ def self.for_children_of: (singleton(Object) base_class, ?final_children_only: bool, ?rerun: bool) -> void
8
+
9
+ class NotInitializable < StandardError
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Reader
4
+ class ExecutionReader
5
+ class ArgumentsReader
6
+ @arguments: DSL::Arguments
7
+ @argument_values: Interpreter::Execution::Arguments
8
+
9
+ def initialize: (DSL::Arguments arguments, Interpreter::Execution::Arguments argument_values) -> void
10
+ def method_missing: (Symbol method_name) -> (ArgumentsReader | nil)
11
+ def has_argument?: (Symbol method_name) -> bool
12
+ def respond_to_missing?: (Symbol method_name) -> bool
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Reader
4
+ class ExecutionReader
5
+ @execution: Interpreter::Execution
6
+
7
+ def initialize: (Interpreter::Execution execution) -> void
8
+ def arguments: -> ArgumentsReader
9
+ def method_called?: (Symbol method_name) -> bool
10
+ def method_missing: (Symbol method_name) -> (nil | ArgumentsReader | Array[ArgumentsReader])
11
+ def respond_to_missing?: (Symbol method_name) -> bool
12
+
13
+ class InvalidExecution < StandardError
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class Reader
4
+ @klass: Class
5
+ @dsl_name: Symbol
6
+ @dsl: DSL
7
+ @dsl_defining_class: Class
8
+
9
+ def initialize: (untyped klass, Symbol dsl_name) -> void
10
+ def last_execution: -> (ExecutionReader | nil)
11
+ def last_execution!: -> ExecutionReader
12
+ def executions: -> Array[ExecutionReader]
13
+ def ancestor_executions: -> Array[ExecutionReader]
14
+ def all_executions: -> Array[ExecutionReader]
15
+ def dsl_used?: -> bool
16
+ def dsl_used_on_ancestors?: -> bool
17
+ def dsl_used_on_class_or_ancestors?: -> bool
18
+
19
+ class DSLNotFound < StandardError
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ # Classes
2
+ module DSLCompose
3
+ class ReaderBase
4
+ attr_reader base_class: singleton(Object)
5
+ attr_reader dsl_name: Symbol
6
+ attr_reader reader: Reader
7
+ def initialize: (singleton(Object) base_class) -> void
8
+
9
+ private
10
+ def dsl_name_from_class_name: (singleton(ReaderBase) reader_class) -> Symbol
11
+ def last_execution: -> (Reader::ExecutionReader | nil)
12
+ def last_execution!: -> Reader::ExecutionReader
13
+ def executions: -> Array[Reader::ExecutionReader]
14
+ def ancestor_executions: -> Array[Reader::ExecutionReader]
15
+ def all_executions: -> Array[Reader::ExecutionReader]
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # Classes
2
+ module DSLCompose
3
+ module SharedConfiguration
4
+ self.@shared_configuration: Hash[Symbol, untyped]
5
+
6
+ def self.add: (Symbol name) -> void
7
+ def self.get: (Symbol name) -> untyped
8
+ def self.clear: -> Hash[Symbol, untyped]
9
+
10
+ class SharedConfigurationAlreadyExistsError < StandardError
11
+ end
12
+
13
+ class SharedConfigurationDoesNotExistError < StandardError
14
+ end
15
+
16
+ class InvalidSharedConfigurationNameError < StandardError
17
+ end
18
+
19
+ class NoBlockProvidedError < StandardError
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ module DSLCompose
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsl_compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-31 00:00:00.000000000 Z
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: class_spec_helper
@@ -79,6 +79,47 @@ files:
79
79
  - lib/dsl_compose/reader_base.rb
80
80
  - lib/dsl_compose/shared_configuration.rb
81
81
  - lib/dsl_compose/version.rb
82
+ - sig/dsl_compose.rbs
83
+ - sig/dsl_compose/class_coerce.rbs
84
+ - sig/dsl_compose/composer.rbs
85
+ - sig/dsl_compose/dsl.rbs
86
+ - sig/dsl_compose/dsl/arguments.rbs
87
+ - sig/dsl_compose/dsl/arguments/argument.rbs
88
+ - sig/dsl_compose/dsl/arguments/argument/end_with_validation.rbs
89
+ - sig/dsl_compose/dsl/arguments/argument/equal_to_validation.rbs
90
+ - sig/dsl_compose/dsl/arguments/argument/format_validation.rbs
91
+ - sig/dsl_compose/dsl/arguments/argument/greater_than_or_equal_to_validation.rbs
92
+ - sig/dsl_compose/dsl/arguments/argument/greater_than_validation.rbs
93
+ - sig/dsl_compose/dsl/arguments/argument/in_validation.rbs
94
+ - sig/dsl_compose/dsl/arguments/argument/interpreter.rbs
95
+ - sig/dsl_compose/dsl/arguments/argument/is_a_validation.rbs
96
+ - sig/dsl_compose/dsl/arguments/argument/length_validation.rbs
97
+ - sig/dsl_compose/dsl/arguments/argument/less_than_or_equal_to_validation.rbs
98
+ - sig/dsl_compose/dsl/arguments/argument/less_than_validation.rbs
99
+ - sig/dsl_compose/dsl/arguments/argument/not_end_with_validation.rbs
100
+ - sig/dsl_compose/dsl/arguments/argument/not_in_validation.rbs
101
+ - sig/dsl_compose/dsl/arguments/argument/not_start_with_validation.rbs
102
+ - sig/dsl_compose/dsl/arguments/argument/start_with_validation.rbs
103
+ - sig/dsl_compose/dsl/dsl_method.rbs
104
+ - sig/dsl_compose/dsl/dsl_method/interpreter.rbs
105
+ - sig/dsl_compose/dsl/interpreter.rbs
106
+ - sig/dsl_compose/dsls.rbs
107
+ - sig/dsl_compose/interpreter.rbs
108
+ - sig/dsl_compose/interpreter/execution.rbs
109
+ - sig/dsl_compose/interpreter/execution/arguments.rbs
110
+ - sig/dsl_compose/interpreter/execution/method_calls.rbs
111
+ - sig/dsl_compose/interpreter/execution/method_calls/method_call.rbs
112
+ - sig/dsl_compose/parser.rbs
113
+ - sig/dsl_compose/parser/block_arguments.rbs
114
+ - sig/dsl_compose/parser/for_children_of_parser.rbs
115
+ - sig/dsl_compose/parser/for_children_of_parser/descendents.rbs
116
+ - sig/dsl_compose/parser/for_children_of_parser/for_dsl_parser.rbs
117
+ - sig/dsl_compose/parser/for_children_of_parser/for_dsl_parser/for_method_parser.rbs
118
+ - sig/dsl_compose/reader.rbs
119
+ - sig/dsl_compose/reader/execution_reader.rbs
120
+ - sig/dsl_compose/reader/execution_reader/arguments_reader.rbs
121
+ - sig/dsl_compose/reader_base.rbs
122
+ - sig/dsl_compose/shared_configuration.rbs
82
123
  homepage:
83
124
  licenses:
84
125
  - MIT