featury 1.0.0.rc4 → 1.0.0.rc5

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: 61aef35ff4aede3e7c747a1b28be3d9ce598b068bc2d355093ac7a6ebb5b0829
4
- data.tar.gz: 40a570d5c32557cc9d7ab325633df8783676bfe48c58f1985bc943f1bb8c1d48
3
+ metadata.gz: 4109a155154dfe53461c79450a8a458f75c310cd4059c7aba50f5ccf44934152
4
+ data.tar.gz: ebe758de6245459700faeded72efe9537b27b7b4a1f63bd958c8cea28bbb1a01
5
5
  SHA512:
6
- metadata.gz: '097cbc783cb17e6648a514190be9bf075868113e089fb21725f9889b92e4293ebe5ea5c2ca49fdebc2ca06c318f37556ca69c56c4703c04a5693de6fbb1eb0de'
7
- data.tar.gz: 3c41249a7db0ead35e581e6f6e517157b46cec9ee03e4f005f0c6529bb0067ec7c14ed7b130d550ffb22e66a72589638cb259b359137aee3f393db9763896238
6
+ metadata.gz: bf21d12a7491f66f223624615b9d56fc1006e009d855513a32eeda2f4e07cc359523a4dd62d36ff9845356bf8b340afba6f9f9813599784a7a528170cba29f3f
7
+ data.tar.gz: bbe7138eb5e70b8dc4a0220b683717f8f1b53ac5e1c8f85504ec2e78b6f55c324780e5ce3cca705b11cd8b06cb23ead7ec24480b284be1ad8e5271ae1062a18e
data/README.md CHANGED
@@ -116,6 +116,17 @@ UserFeature::Onboarding.enable(user:) # => true
116
116
  UserFeature::Onboarding.disable(user:) # => false
117
117
  ```
118
118
 
119
+ You can also use the `with` method to pass arguments if needed.
120
+
121
+ ```ruby
122
+ feature = UserFeature::Onboarding.with(user:)
123
+
124
+ feature.enabled? # => true
125
+ feature.disabled? # => false
126
+ feature.enable # => true
127
+ feature.disable # => false
128
+ ```
129
+
119
130
  If one of the feature flags is turned off, for example,
120
131
  through your automation, then the main feature class will
121
132
  return `false` when asked "is it enabled?".
@@ -21,7 +21,7 @@ module Featury
21
21
  @model_class.const_set(Builder::SERVICE_CLASS_NAME, class_sample)
22
22
  end
23
23
 
24
- def create_service_class # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
24
+ def create_service_class # rubocop:disable Metrics/MethodLength, Metrics/AbcSize,Metrics/CyclomaticComplexity
25
25
  collection_of_resources = @collection_of_resources
26
26
 
27
27
  Class.new(Featury::Service::Builder) do
@@ -56,7 +56,7 @@ module Featury
56
56
  end
57
57
  end
58
58
 
59
- def check_features
59
+ def check_features # rubocop:disable Metrics/AbcSize
60
60
  options = inputs.collection_of_resources.only_option.to_h do |resource|
61
61
  [resource.name, inputs.public_send(resource.name)]
62
62
  end
@@ -65,7 +65,7 @@ module Featury
65
65
  inputs.action.block.call(features: inputs.collection_of_features.list, **options)
66
66
  end
67
67
 
68
- def check_groups
68
+ def check_groups # rubocop:disable Metrics/AbcSize
69
69
  arguments = inputs.collection_of_resources.only_nested.to_h do |resource|
70
70
  [resource.name, inputs.public_send(resource.name)]
71
71
  end
@@ -10,6 +10,8 @@ module Featury
10
10
 
11
11
  context = send(:new)
12
12
 
13
+ arguments.merge!(@with_arguments) if @with_arguments.is_a?(Hash)
14
+
13
15
  _call!(context, action, **arguments)
14
16
  end
15
17
 
@@ -17,6 +19,12 @@ module Featury
17
19
  collection_of_actions.names.include?(method_name) || super
18
20
  end
19
21
 
22
+ def with(arguments = {})
23
+ @with_arguments = arguments
24
+
25
+ self
26
+ end
27
+
20
28
  private
21
29
 
22
30
  def _call!(context, action, **arguments)
@@ -5,7 +5,7 @@ module Featury
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc4"
8
+ PRE = "rc5"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featury
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc4
4
+ version: 1.0.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-22 00:00:00.000000000 Z
11
+ date: 2024-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport