module Featuring::Persistence::Adapter
- public
-
Defines the behavior for feature flag adapters.
Adapters are modules that are extended by {Adapter}. They must define three methods:
1. `fetch`: Returns persisted feature flag values for a given object. 2. `create`: Creates feature flags for a given object. 3. `update`: Updates feature flags for a given object. 4. `replace`: Replaces feature flags for a given object.
See ‘Featuring::Persistence::ActiveRecord` for a complete example.
Public Instance Methods
included(object)
click to toggle source
# File lib/featuring/persistence/adapter.rb, line 23 def included(object) object.instance_feature_class.prepend Methods object.instance_feature_class.module_exec(self) do |adapter| define_method :feature_flag_adapter do adapter end end # Give adapters the ability to extend the object with persistent flags. # if const_defined?("Flaggable", false) object.prepend(const_get("Flaggable")) end end