dsl_compose 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 535a5086604fa5366f7a9baf2cc1a1ef823d4f29f16d8fc273b78a680180c3e2
4
- data.tar.gz: 12f9bfc80a59ad1cbf61ad03795fd6e29535618c41143dbb7d8afb1228c7f3ae
3
+ metadata.gz: 826d148f5440924eeea1a56699ec7f6a421dcf5fe273012e7e9cf9010ab4cb66
4
+ data.tar.gz: 0fa06d0fcf99bea843da3b3b5cb66f196be88a923287ba4df64459e6289f7054
5
5
  SHA512:
6
- metadata.gz: 768fbc012d89a3542f0c96934bfc9187098c790a4a7d975dff80ae63ba1e50c0eb19e8f8abddacf234410839fd1a5688eb76c30a51ed939485d219c67263c5f7
7
- data.tar.gz: 3553a51fc949265b84866761ce8ee5ed2ae4de67d2db17da36b4d646a21a5feb34b91f0085a3fcdfa54c5707457aa3cc0adc9c63d3da5820e042e372d5224603
6
+ metadata.gz: c4bcce09e0c5b3028c97ac09dbd16a6481ed8514857e7bcaecbbe7b40aebec22b8d7b4220f299380363dd9b87de9c0585fa456d8c70c031e967d3e6048711b60
7
+ data.tar.gz: 20eb3288cafb32aafddc8efe78e2e8fba5cf088c1896b5a9e82eb42e21c63c84d6e2536888d5e938f9f4b9bc80d064bfb5e95ca2fdb410316707f0362e0bf6cf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.1](https://github.com/craigulliott/dsl_compose/compare/v2.1.0...v2.1.1) (2023-07-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fixed bug where Execution classes were being returned from within the Reader but ExecutionReader classes were expected ([#56](https://github.com/craigulliott/dsl_compose/issues/56)) ([546cdaf](https://github.com/craigulliott/dsl_compose/commit/546cdaf323f3fc3be6ad09a47e5f99c3a59a50e2))
9
+
3
10
  ## [2.1.0](https://github.com/craigulliott/dsl_compose/compare/v2.0.1...v2.1.0) (2023-07-24)
4
11
 
5
12
 
data/README.md CHANGED
@@ -168,7 +168,7 @@ You can use `import_shared` anywhere within your DSL definition, you can even us
168
168
  Child classes can then use your new DSL
169
169
 
170
170
  ```ruby
171
- class Bar << Foo
171
+ class Bar < Foo
172
172
 
173
173
  your_dsl :first_dsl_argument, do
174
174
  your_method "first_method_argument", optional_argument: 123
@@ -239,7 +239,7 @@ A parser class can be used to process complicated DSLs. In the example below, a
239
239
 
240
240
  ```ruby
241
241
  # create your own parser by creating a new class which extends DSLCompose::Parser
242
- MyParser < DSLCompose::Parser
242
+ class MyParser < DSLCompose::Parser
243
243
  # `for_children_of` will process SomeBaseClass and yield the provided
244
244
  # block once for every class which extends SomeBaseClass.
245
245
  #
@@ -312,7 +312,7 @@ MyParser < DSLCompose::Parser
312
312
  end
313
313
  ```
314
314
 
315
- In addition to parser classes (or as a useful tool within parser classes) you can access the results of DSL execution via the class (or via a descendent of the class) where the DSL was originally defined.
315
+ In addition to parser classes (or as a useful tool within parser classes) you can access the results of DSL execution with a Reader class.
316
316
 
317
317
  ```ruby
318
318
  # Create a new Reader object.
@@ -15,6 +15,8 @@ module DSLCompose
15
15
  class MethodDoesNotExist < StandardError
16
16
  end
17
17
 
18
+ attr_reader :execution
19
+
18
20
  def initialize execution
19
21
  raise InvalidExecution unless execution.is_a? Interpreter::Execution
20
22
  @execution = execution
@@ -51,13 +51,15 @@ module DSLCompose
51
51
  # and look for the last time it was executed on each ancestor.
52
52
  # If no execution of the DSL is found, then nil will be returned
53
53
  def last_execution
54
- @dsl_defining_class.dsls.get_last_dsl_execution @klass, @dsl_name
54
+ ExecutionReader.new(@dsl_defining_class.dsls.get_last_dsl_execution(@klass, @dsl_name))
55
55
  end
56
56
 
57
57
  # Returns an array of ExecutionReaders to represent each time the DSL was used
58
58
  # on the provided class.
59
59
  def executions
60
- @dsl_defining_class.dsls.class_dsl_executions @klass, @dsl_name, true, false
60
+ @dsl_defining_class.dsls.class_dsl_executions(@klass, @dsl_name, true, false).map do |execution|
61
+ ExecutionReader.new execution
62
+ end
61
63
  end
62
64
 
63
65
  # Returns an array of ExecutionReaders to represent each time the DSL was used
@@ -66,7 +68,9 @@ module DSLCompose
66
68
  # earliest ancestor first and if the DSL was used more than once on a class then
67
69
  # the order they were used.
68
70
  def ancestor_executions
69
- @dsl_defining_class.dsls.class_dsl_executions @klass, @dsl_name, false, true
71
+ @dsl_defining_class.dsls.class_dsl_executions(@klass, @dsl_name, false, true).map do |execution|
72
+ ExecutionReader.new execution
73
+ end
70
74
  end
71
75
 
72
76
  # Returns an array of ExecutionReaders to represent each time the DSL was used
@@ -74,7 +78,9 @@ module DSLCompose
74
78
  # be returned in the order they were executed, which is the earliest ancestor first
75
79
  # and if the DSL was used more than once on a class then the order they were used.
76
80
  def all_executions
77
- @dsl_defining_class.dsls.class_dsl_executions @klass, @dsl_name, true, true
81
+ @dsl_defining_class.dsls.class_dsl_executions(@klass, @dsl_name, true, true).map do |execution|
82
+ ExecutionReader.new execution
83
+ end
78
84
  end
79
85
  end
80
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSLCompose
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
  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.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-24 00:00:00.000000000 Z
11
+ date: 2023-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: class_spec_helper
@@ -79,13 +79,13 @@ files:
79
79
  - lib/dsl_compose/reader/execution_reader/arguments_reader.rb
80
80
  - lib/dsl_compose/shared_configuration.rb
81
81
  - lib/dsl_compose/version.rb
82
- homepage:
82
+ homepage:
83
83
  licenses:
84
84
  - MIT
85
85
  metadata:
86
86
  source_code_uri: https://github.com/craigulliott/dsl_compose/
87
87
  changelog_uri: https://github.com/craigulliott/dsl_compose/blob/main/CHANGELOG.md
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubygems_version: 3.3.26
104
- signing_key:
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: Ruby gem to add dynamic DSLs to classes
107
107
  test_files: []