featury 1.0.0.rc18 → 1.0.0.rc19

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: 746a97b6b6689e1ac4a1dd05217229576b5ee8151890f077390f9050a2d9dd39
4
- data.tar.gz: 0bff11a8adb7f725b4832660e8f3b61d434869ee1df27e2d07c2e01967dc11c2
3
+ metadata.gz: 90d7f0c59fc6810d609fa806bb5fa60cda2894c66bacbfd8f6015c05f9d8d376
4
+ data.tar.gz: 21fbdbca92e6583fc9f02261c2de3344d1c91740b0dc72df6810c2102a9a907c
5
5
  SHA512:
6
- metadata.gz: 9836aa3917bcafcf4648707baa4a71bdd1a99a73464b007ee9ee805ddacf4b08af6174350ef168131aac254b601b4ed7a6a7f0a1261ea67b3a6c1f8ee6bfd7ac
7
- data.tar.gz: ba036730e1e6e51b1574d01591ade4941430308713e0e300ac0dc19e01951b7bc75222a0bb3536facfca3f9644394edf3f642c27c87fed1c6ab06399b52282af
6
+ metadata.gz: 3909dee49e854c7c4b380f23a1f7fb70028a3c84c16d99bd1a1978f152d40684b28f5df2249cbd7c0627fb6b148b4f73a3967382e7914fe4186f683f26899d37
7
+ data.tar.gz: 513add3e16f4a5fabd4790ac161f3d5e6a2252c3580ec2f7be01d5219c5cfccfecce5cfe147a3b233b689facfe1469e553250c0315d82b48a41f6fb07ced2d1e
data/README.md CHANGED
@@ -40,19 +40,19 @@ In such a scenario, the base class could potentially be structured as follows:
40
40
 
41
41
  ```ruby
42
42
  class ApplicationFeature < Featury::Base
43
- action :enabled?, web: :main do |features:, **options|
43
+ action :enabled?, web: :enabled? do |features:, **options|
44
44
  features.all? { |feature| Flipper.enabled?(feature, *options.values) }
45
45
  end
46
46
 
47
- action :disabled?, web: :use do |features:, **options|
47
+ action :disabled?, web: :regular do |features:, **options|
48
48
  features.any? { |feature| !Flipper.enabled?(feature, *options.values) }
49
49
  end
50
50
 
51
- action :enable, web: :use do |features:, **options|
51
+ action :enable, web: :enable do |features:, **options|
52
52
  features.all? { |feature| Flipper.enable(feature, *options.values) }
53
53
  end
54
54
 
55
- action :disable, web: :use do |features:, **options|
55
+ action :disable, web: :disable do |features:, **options|
56
56
  features.all? { |feature| Flipper.disable(feature, *options.values) }
57
57
  end
58
58
 
@@ -70,6 +70,16 @@ class ApplicationFeature < Featury::Base
70
70
  end
71
71
  ```
72
72
 
73
+ #### About the `web:` key
74
+
75
+ The `web:` key in the action definition allows you to specify which method will be used for web interactions. This is useful for mapping internal action names to external endpoints or UI actions. For example:
76
+
77
+ - `enabled?` — the method that will be used in the web context to check the state of a feature flag;
78
+ - `enable` — the method that will be used in the web context to enable a feature flag;
79
+ - `disable` — the method that will be used in the web context to disable a feature flag.
80
+
81
+ This mapping helps you clearly separate internal logic from the interface exposed to web clients.
82
+
73
83
  #### Features of your project
74
84
 
75
85
  ```ruby
@@ -13,12 +13,20 @@ module Featury
13
13
  @block = block
14
14
  end
15
15
 
16
- def main_web?
17
- @web == :main
16
+ def web_enabled?
17
+ @web == :enabled?
18
18
  end
19
19
 
20
- def regular_web?
21
- @web == :use
20
+ def web_enable?
21
+ @web == :enable
22
+ end
23
+
24
+ def web_disable?
25
+ @web == :disable
26
+ end
27
+
28
+ def web_regular?
29
+ @web == :regular
22
30
  end
23
31
  end
24
32
  end
@@ -11,15 +11,30 @@ module Featury
11
11
  end
12
12
 
13
13
  def for_web
14
- Collection.new(filter { |action| action.main_web? || action.regular_web? })
14
+ Collection.new(
15
+ filter do |action|
16
+ action.web_enabled? ||
17
+ action.web_enable? ||
18
+ action.web_disable? ||
19
+ action.web_regular?
20
+ end
21
+ )
15
22
  end
16
23
 
17
24
  def names
18
25
  map(&:name)
19
26
  end
20
27
 
21
- def main_web
22
- find(&:main_web?)
28
+ def web_enabled
29
+ find(&:web_enabled?)
30
+ end
31
+
32
+ def web_enable
33
+ find(&:web_enable?)
34
+ end
35
+
36
+ def web_disable
37
+ find(&:web_disable?)
23
38
  end
24
39
 
25
40
  def find_by(name:)
@@ -6,11 +6,15 @@ module Featury
6
6
  class Actions
7
7
  class Web
8
8
  attr_reader :all,
9
- :main
9
+ :enabled,
10
+ :enable,
11
+ :disable
10
12
 
11
13
  def initialize(collection_of_actions)
12
14
  @all = collection_of_actions.names
13
- @main = collection_of_actions.main_web.name
15
+ @enabled = collection_of_actions.web_enabled.name
16
+ @enable = collection_of_actions.web_enable.name
17
+ @disable = collection_of_actions.web_disable.name
14
18
  end
15
19
  end
16
20
 
@@ -5,7 +5,7 @@ module Featury
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc18"
8
+ PRE = "rc19"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featury
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc18
4
+ version: 1.0.0.rc19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov