lib/flipper/adapter.rb in flipper-1.0.0 vs lib/flipper/adapter.rb in flipper-1.1.0
- old
+ new
@@ -10,10 +10,11 @@
def default_config
{
boolean: nil,
groups: Set.new,
actors: Set.new,
+ expression: nil,
percentage_of_actors: nil,
percentage_of_time: nil,
}
end
@@ -21,10 +22,14 @@
return source if source.is_a?(Flipper::Adapter)
source.adapter
end
end
+ def read_only?
+ false
+ end
+
# Public: Get all features and gate values in one call. Defaults to one call
# to features and another to get_multi. Feel free to override per adapter to
# make this more efficient.
def get_all
instances = features.map { |key| Flipper::Feature.new(key, self) }
@@ -60,9 +65,14 @@
end
# Public: Default config for a feature's gate values.
def default_config
self.class.default_config
+ end
+
+ # Public: default name of the adapter
+ def name
+ @name ||= self.class.name.split('::').last.split(/(?=[A-Z])/).join('_').downcase.to_sym
end
end
end
require "set"