lopata 0.1.38 → 0.1.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 343bc2e98af0f7d7af41cca5bbd2ed235810c767d69cb53ccb7d1634f5fd5de8
4
- data.tar.gz: ae551d28c3d67713ba7aae4c79ab9e753092ebbfefb64df640cf0e3bc8ab6098
3
+ metadata.gz: 6b391941e9c4d4e42dca98434fc3ccae1275ec3681cc38a3c3aded8fbabff909
4
+ data.tar.gz: 7c8a4d068f8ffdf583413f0fa156441c20d4cab95643a430c02d8b28c7c0fdea
5
5
  SHA512:
6
- metadata.gz: 2f0a2f0aae729ba534fd6498355a8df89c5c040ad3e2c90ddcc39f28a30d5c5e67ec4661287af145a9ebed0a5bf2eec1d2aeac837f39f915f3a5ef084896a5a0
7
- data.tar.gz: 715c0ca557f97fe2d1ad00034c354d227ba5012952aa9d2ca356c1be32792993840bef889b1689c1c356f347b0488b317038946fb742b04d09c5aac8ed196f64
6
+ metadata.gz: efbd16b2aea6b5debe630e5739a730cda91de1311682d01527aabc56c5b755055dc9aaae4a003ad317a7b5739450db117423c491be628f077b6d94af4f21476f
7
+ data.tar.gz: 2a7db79eda5d90471d111c54093fab7470055bcedd54aa75b58e5b101af5007671a3f3315f92f4d0baf48086ed1800f7790e9db07d5219867abe915355fb7c44
data/lib/lopata/role.rb CHANGED
@@ -133,6 +133,7 @@ module Lopata
133
133
  # @private
134
134
  def option_combinations
135
135
  return super() unless @role_groups
136
+ share_role_group_metadata_keys
136
137
  @role_groups.flat_map do |group|
137
138
  begin
138
139
  @current_role_group = group
@@ -146,6 +147,17 @@ module Lopata
146
147
 
147
148
  private
148
149
 
150
+ # Variants of the same metadata key may be declared in several role groups. Each group knows only the keys
151
+ # of its own variants, so the keys used in other groups are not defined (NoMethodError on access).
152
+ # Share the keys across the groups to get nil for them, as for the variants of a single option.
153
+ def share_role_group_metadata_keys
154
+ all = @role_groups.flat_map { |g| g.options + g.diagonals }
155
+ all.group_by(&:key).each_value do |same_key|
156
+ keys = same_key.flat_map(&:available_metadata_keys).uniq
157
+ same_key.each { |o| o.available_metadata_keys = keys }
158
+ end
159
+ end
160
+
149
161
  def add_role_group(roles, use_all_roles, &block)
150
162
  if @roles || @without_user
151
163
  raise ArgumentError, 'Role groups (as/as_first with block) can not be combined with plain role declaration'
@@ -471,6 +471,7 @@ class Lopata::ScenarioBuilder
471
471
  # @private
472
472
  class Option
473
473
  attr_reader :variants, :key, :use_all_variants
474
+ attr_writer :available_metadata_keys
474
475
  def initialize(key, variants, use_all_variants = true)
475
476
  @key = key
476
477
  @variants =
@@ -1,6 +1,6 @@
1
1
  module Lopata
2
2
  # @private
3
3
  module Version
4
- STRING = '0.1.38'
4
+ STRING = '0.1.39'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lopata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Volochnev
@@ -135,5 +135,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements: []
136
136
  rubygems_version: 4.0.20
137
137
  specification_version: 4
138
- summary: lopata-0.1.38
138
+ summary: lopata-0.1.39
139
139
  test_files: []