module Flipper::Adapter

Adding a module include so we have some hooks for stuff down the road

Public Class Methods

included(base) click to toggle source
# File lib/flipper/adapter.rb, line 8
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

default_config() click to toggle source

Public: Default config for a feature's gate values.

# File lib/flipper/adapter.rb, line 52
def default_config
  self.class.default_config
end
get_all() click to toggle source

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.

# File lib/flipper/adapter.rb, line 28
def get_all
  instances = features.map { |key| Flipper::Feature.new(key, self) }
  get_multi(instances)
end
get_multi(features) click to toggle source

Public: Get multiple features in one call. Defaults to one get per feature. Feel free to override per adapter to make this more efficient and reduce network calls.

# File lib/flipper/adapter.rb, line 36
def get_multi(features)
  result = {}
  features.each do |feature|
    result[feature.key] = get(feature)
  end
  result
end
import(source_adapter) click to toggle source

Public: Ensure that adapter is in sync with source adapter provided.

Returns result of Synchronizer#call.

# File lib/flipper/adapter.rb, line 47
def import(source_adapter)
  Adapters::Sync::Synchronizer.new(self, source_adapter, raise: true).call
end