abstract-synthesizer 0.0.13 → 0.0.14
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/Gemfile.lock +1 -1
- data/docs/usage.md +1 -1
- data/gemset.nix +1 -1
- data/lib/GEMINI.md +1 -1
- data/lib/abstract-synthesizer/errors/GEMINI.md +1 -1
- data/lib/abstract-synthesizer/version.rb +1 -1
- data/lib/abstract-synthesizer.rb +3 -9
- metadata +1 -2
- data/lib/abstract-synthesizer/errors/not_enough_resource_keys.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 464ebe4ab26cb13becade2b40754e2d158885813780308fbead99ba9d204649e
|
4
|
+
data.tar.gz: ff6cfc9eced8061ee6565c4662a9b813ec31bff199404f7f68a99e8bca0e2998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3879dc3a011f6a73c481a84b356ace5279e8396594008924ef50271d339a0f4d7e9c86580c48343b07ee4b8e0b6c687bd77a603d0f73262f0250ed0a56bae9f3
|
7
|
+
data.tar.gz: fb12e562983180e8e5fb125306189262467468d2be875dd9c9878bf32b07536554aac85a6e92182017a62bc2b217bb70ca3c1365a75b7caa091e6cc66db94cc5
|
data/Gemfile.lock
CHANGED
data/docs/usage.md
CHANGED
@@ -113,4 +113,4 @@ The gem provides specific error classes for common issues:
|
|
113
113
|
|
114
114
|
- `InvalidSynthesizerKeyError`: Raised when you try to use a method in your DSL that was not included in the `keys` provided to `SynthesizerFactory.create_synthesizer`.
|
115
115
|
- `TooManyFieldValuesError`: Raised when a field assignment method receives more than one argument.
|
116
|
-
|
116
|
+
|
data/gemset.nix
CHANGED
data/lib/GEMINI.md
CHANGED
@@ -16,7 +16,7 @@ Key features and methods:
|
|
16
16
|
- `manifest`: An alias for `synthesis`.
|
17
17
|
- `valid_method?(method, keys)`: Internal method to check if a method call is valid within the current context (resource definition or field assignment).
|
18
18
|
- `validate_method(method, keys)`: Raises `InvalidSynthesizerKeyError` if a method is not valid.
|
19
|
-
- `validate_args(args)`: Validates the number of arguments based on the current context, raising `
|
19
|
+
- `validate_args(args)`: Validates the number of arguments based on the current context, raising `TooManyFieldValuesError`.
|
20
20
|
- `abstract_method_missing(method, keys, *args)`: This is the core of the DSL. It dynamically handles method calls, interpreting them as resource keys or field assignments, and building the `translation[:manifest]` accordingly. It uses the `Bury` module for nested data insertion.
|
21
21
|
|
22
22
|
## SynthesizerFactory Module
|
@@ -3,5 +3,5 @@
|
|
3
3
|
This directory contains custom error classes used by the `abstract-synthesizer` gem. These errors are raised when specific conditions are not met during the synthesis process, providing clear feedback to the user.
|
4
4
|
|
5
5
|
- `invalid_synthesizer_key_error.rb`: Defines `InvalidSynthesizerKeyError`. This error is raised when the synthesizer attempts to process a key (method call) that is not defined or recognized as a valid resource key within the DSL.
|
6
|
-
|
6
|
+
|
7
7
|
- `too_many_field_values.rb`: Defines `TooManyFieldValuesError`. This error is raised when too many field values are provided for a given field, indicating an incorrect usage of the DSL.
|
data/lib/abstract-synthesizer.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative %(abstract-synthesizer/errors/invalid_synthesizer_key_error)
|
2
2
|
require_relative %(abstract-synthesizer/errors/too_many_field_values)
|
3
|
-
|
3
|
+
|
4
4
|
require_relative %(abstract-synthesizer/primitives/bury)
|
5
5
|
|
6
6
|
class AbstractSynthesizer
|
@@ -65,20 +65,14 @@ class AbstractSynthesizer
|
|
65
65
|
raise InvalidSynthesizerKeyError, err_msg unless valid_method?(method, keys)
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
if translation[:ancestors].empty?
|
70
|
-
raise NotEnoughResourceKeys unless args.length.eql?(2)
|
71
|
-
elsif !args.length.eql?(1)
|
72
|
-
raise TooManyFieldValuesError
|
73
|
-
end
|
74
|
-
end
|
68
|
+
|
75
69
|
|
76
70
|
def abstract_method_missing(method, keys, *args)
|
77
71
|
keys = keys.map(&:to_sym)
|
78
72
|
method = method.to_sym
|
79
73
|
|
80
74
|
validate_method(method, keys)
|
81
|
-
|
75
|
+
|
82
76
|
|
83
77
|
keys.each do |key|
|
84
78
|
if key.eql?(translation[:context])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstract-synthesizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- drzzln@protonmail.com
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- lib/abstract-synthesizer/GEMINI.md
|
80
80
|
- lib/abstract-synthesizer/errors/GEMINI.md
|
81
81
|
- lib/abstract-synthesizer/errors/invalid_synthesizer_key_error.rb
|
82
|
-
- lib/abstract-synthesizer/errors/not_enough_resource_keys.rb
|
83
82
|
- lib/abstract-synthesizer/errors/too_many_field_values.rb
|
84
83
|
- lib/abstract-synthesizer/primitives/GEMINI.md
|
85
84
|
- lib/abstract-synthesizer/primitives/bury.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
class NotEnoughResourceKeys < StandardError; end
|