dsl_compose 2.2.2 → 2.3.0

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: 1b5f53afb63b68aac27995b0fee8dceb7c0f5649a171f187bf95c85ebe29215e
4
- data.tar.gz: 9ee378a6a342684339a0ff2472ed0aa37fb4d3a5e3e3f71f9eb9b87d5f013b37
3
+ metadata.gz: 4fab8958e567edd7044bfef529f74c21930c7c1fba06bfd359d905249fc2d17c
4
+ data.tar.gz: a167ad2aaaf44b226b2884ee0f4d6447444ebe0629453ca5f288430c5198e683
5
5
  SHA512:
6
- metadata.gz: 6f9494f1e9054d83bff8601aa6bf2c7e6fc887af2a7c3f762649d32d71116fa0c9856f1d94811df32246f7cf345eafdb06987946da9524832d2a8c9e366f4284
7
- data.tar.gz: 42f04fe0ee1e3341716a446fd3747ba7bce072d921dcb2cf62ebe3a8d4e7112336ec3b5d42cd87c56076cbbaf36f29ccfe3925f1e1f13776d4d5a38f244f1b9f
6
+ metadata.gz: fcd2f5ff1b501cffd445d937f4a96e158250e8e76e48969d54760511dc339dc90e0d7d1d3f4f2ed5a14ffc0eafe037a8833122a0f649c071a8188e1819901bb4
7
+ data.tar.gz: e1df9014ea4b8a20db709e44284ce320a92808085aee70004a4bac19609fad866f271426e2e86c7ec46919f21795f55c91411b1404f73cfd0349544ef71ee408
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.3.0](https://github.com/craigulliott/dsl_compose/compare/v2.2.2...v2.3.0) (2023-07-28)
4
+
5
+
6
+ ### Features
7
+
8
+ * added a method_called? helper method to the DSL parser ([48e68a8](https://github.com/craigulliott/dsl_compose/commit/48e68a8d799e297d3433f3d2a6bccb7a077dd9af))
9
+
3
10
  ## [2.2.2](https://github.com/craigulliott/dsl_compose/compare/v2.2.1...v2.2.2) (2023-07-27)
4
11
 
5
12
 
data/README.md CHANGED
@@ -286,6 +286,12 @@ class MyParser < DSLCompose::Parser
286
286
  other than making calls to `for_method`
287
287
  DESCRIPTION
288
288
 
289
+ # Within a `for_dsl` block you can determine if a specific DSL method was used
290
+ # with the `method_called?` method. This method will return true if the method was
291
+ # used, otherwise it will return false. If a method with the provided name does not
292
+ # exist for the DSL, then an error will be raised.
293
+ was_some_method_name_used = method_called? :some_method_name
294
+
289
295
  # `for_method` accepts a method name or an array of method names and will
290
296
  # yield it's provided block once for each time a method with this name is
291
297
  # executed within the DSL.
@@ -109,6 +109,16 @@ module DSLCompose
109
109
  ForMethodParser.new(@base_class, @child_class, @dsl_execution, method_names, &block)
110
110
  end
111
111
 
112
+ # Given a method name, will return true if the method was called within the current DSL
113
+ # execution, otherwise it will return false
114
+ def method_called? method_name
115
+ # get the dsl method from the current dsl execution, this
116
+ # will raise an error if the method does not exist
117
+ dsl_method = @dsl_execution.dsl.dsl_method(method_name)
118
+ # was this method called within the current DSL execution?
119
+ @dsl_execution.method_calls.method_called? dsl_method.name
120
+ end
121
+
112
122
  # takes a description of what this parser does and stores it against the DSL definition
113
123
  # of the current @child_class, this is used to generate documentation for what the parser
114
124
  # has done with the DSL
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSLCompose
4
- VERSION = "2.2.2"
4
+ VERSION = "2.3.0"
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.2.2
4
+ version: 2.3.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-07-27 00:00:00.000000000 Z
11
+ date: 2023-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: class_spec_helper