flipside 0.3.2 → 0.3.4

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: c535d4251e9119b215ca601c3d1a59c595d6554edb8fe5bb85438dea02d215e2
4
- data.tar.gz: de524dc5a8def73cf07b62d311594bad9069857ebbe0ab8f3277d40132a1ebfe
3
+ metadata.gz: 658bbe055472e1a880352ecd5af0cbeacc9c0988274dc798610baadaeae7d33b
4
+ data.tar.gz: 55dcb7671784fee2bdcef7fdd6f26390aa7cd1e7ebc9c443199eadd18bfaf614
5
5
  SHA512:
6
- metadata.gz: 10f6b91375dd7562188a129206d49da15d0e2fd91753369d78e2cd988d672b706ef69d0a366c3e41a433aa24ed816250c1af70e59f12e5d90aabff3c4e7eee4d
7
- data.tar.gz: bd9fb2f1bc985759de41ab08c4c5878c8820ae458ba66782719400825d504175ab91f5eec130c0e2d97f025467df3c7b067199a0740f02e045e75dcac77d25d2
6
+ metadata.gz: 3170999fd42dcecf0232142f55430a9812e0926714f3ed543637ca5ce2b44dd932357e86b5c091b7c5e861de848ff4095eb9cc778e04311f84ecc9e4e8140796
7
+ data.tar.gz: 57ee735a9edfed83fc66283d7747a5e75614a6dc2de56628b4671796ee7e9dad03c07c82cf844aff9d59cab6bb635cd3fdd694d44345b7e55f0594135b31b46a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.3.4] - 2026-03-04
2
+ - Support an array of default objects
3
+
4
+ ## [0.3.3] - 2025-08-21
5
+ - Move gem ownership
6
+
1
7
  ## [0.3.2] - 2025-05-28
2
8
  - Add button to delete a feature
3
9
  - Make switch light blue when feature is partially enabled
data/README.md CHANGED
@@ -93,7 +93,7 @@ Features can be enabled for a certain record, typically a certain user or organi
93
93
  ```ruby
94
94
  user = User.first
95
95
  Flipside.enabled? "MyFeature", user # => false
96
- Flipside.add_entity(name: "MyFeature", user)
96
+ Flipside.add_entity(name: "MyFeature", entity: user)
97
97
  Flipside.enabled? "MyFeature", user # => true
98
98
  ```
99
99
 
@@ -125,7 +125,7 @@ Note: you probably want to wrap this inside a constraints block to provide some
125
125
 
126
126
  ### Configuration
127
127
 
128
- The Flipside UI can be configured by calling some class methods on `Flipside` (see below).
128
+ Flipside can be configured by calling some class methods on `Flipside` (see below).
129
129
 
130
130
  `ui_back_path` is used to set a path to return to from the Flipside UI. If this is set, then the UI shows a "Back" button,
131
131
  targeting this path/url. By default no back button is shown.
@@ -149,6 +149,11 @@ Flipside.enabled? :some_feature
149
149
  # Which will be the same as
150
150
  Flipside.enabled? :some_feature, Current.user
151
151
 
152
+ # If `default_object` is an Array, then each element is checked if the feature is enabled.
153
+ ```ruby
154
+ Flipside.default_object = -> { [Current.user, Current.organization] }
155
+ ```
156
+
152
157
  # Note: if we do pass in an argument, then `default_object ` will not be used:
153
158
  Flipside.enabled? :some_feature, Current.company # check current company instead of user.
154
159
  ```
@@ -242,7 +247,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
242
247
 
243
248
  ## Contributing
244
249
 
245
- Bug reports and pull requests are welcome on GitHub at https://github.com/[sammyhenningsson]/flipside.
250
+ Bug reports and pull requests are welcome on GitHub at https://github.com/apoex/flipside.
246
251
 
247
252
  ## License
248
253
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Flipside
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
data/lib/flipside.rb CHANGED
@@ -26,7 +26,8 @@ module Flipside
26
26
  feature = find_by(name:)
27
27
  return false unless feature
28
28
 
29
- objects = [default_object] if objects.empty?
29
+ objects = Array(default_object) if objects.empty?
30
+ objects << nil if objects.empty?
30
31
  objects.any? { |object| feature.enabled? object }
31
32
  end
32
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipside
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sammy Henningsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-28 00:00:00.000000000 Z
11
+ date: 2026-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -167,13 +167,13 @@ files:
167
167
  - lib/flipside/web.rb
168
168
  - lib/generators/flipside/install/install_generator.rb
169
169
  - lib/generators/flipside/install/templates/20241122_create_flipside_migration.rb
170
- homepage: https://github.com/sammyhenningsson/flipside
170
+ homepage: https://github.com/apoex/flipside
171
171
  licenses:
172
172
  - MIT
173
173
  metadata:
174
- homepage_uri: https://github.com/sammyhenningsson/flipside
175
- source_code_uri: https://github.com/sammyhenningsson/flipside
176
- changelog_uri: https://github.com/sammyhenningsson/flipside/blob/main/CHANGELOG.md
174
+ homepage_uri: https://github.com/apoex/flipside
175
+ source_code_uri: https://github.com/apoex/flipside
176
+ changelog_uri: https://github.com/apoex/flipside/blob/main/CHANGELOG.md
177
177
  post_install_message:
178
178
  rdoc_options: []
179
179
  require_paths: