Class: Feature::Repository::SimpleRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/feature/repository/simple_repository.rb

Overview

SimpleRepository for active feature list Simply add features to that should be active, no config or data sources required.

Example usage:

repository = SimpleRepository.new
repository.add_active_feature(:feature_name)
# use repository with Feature

Instance Method Summary collapse

Constructor Details

#initializeSimpleRepository

Constructor



15
16
17
# File 'lib/feature/repository/simple_repository.rb', line 15

def initialize
  @active_features = []
end

Instance Method Details

#active_featuresArray<Symbol>

Returns list of active features

Returns:

  • (Array<Symbol>)

    list of active features



23
24
25
# File 'lib/feature/repository/simple_repository.rb', line 23

def active_features
  @active_features.dup
end

#add_active_feature(feature) ⇒ Object

Add an active feature to repository

Parameters:

  • feature (Symbol)

    the feature to be added



31
32
33
34
35
# File 'lib/feature/repository/simple_repository.rb', line 31

def add_active_feature(feature)
  check_feature_is_not_symbol(feature)
  check_feature_already_in_list(feature)
  @active_features << feature
end