We recently wrote something like the following, hoping to set a generic group for flipper usage.
Flipper.register(:reviewers) do |actor|
actor.try(:email) =~ /@example.com\z/
end
It didn't work, because String#=~ returns an integer (the position of the match in the string) rather than true/false. Flipper groups only respond if the register block explicitly returns true.
This seems a bit unrubyish, so I wondered if there was a specific reason that only true was allowed rather than (IMO) the more usual convention of any truthy value?
We recently wrote something like the following, hoping to set a generic group for flipper usage.
It didn't work, because
String#=~returns an integer (the position of the match in the string) rather than true/false. Flipper groups only respond if theregisterblock explicitly returnstrue.This seems a bit unrubyish, so I wondered if there was a specific reason that only
truewas allowed rather than (IMO) the more usual convention of any truthy value?