feature.rb

Path: lib/feature.rb
Last Update: Sat Feb 23 07:11:47 +0000 2019

Feature module provides all methods

  • to set a feature repository
  • to check if a feature (represented by a symbol) is active or inactive
  • for conditional block execution with or without a feature
  • to refresh the feature lists (request them from repository)

@note all features not active will be handled has inactive

Example usage:

  repository = SimpleRepository.new
  repository.add_active_feature(:feature_name)

  Feature.set_repository(repository)
  Feature.active?(:feature_name)
  # => true
  Feature.inactive?(:inactive_feature)
  # => false

  Feature.with(:feature_name) do
    # code will be executed
  end

Required files

feature/repository   feature/generators/install_generator  

[Validate]