Sha256: bca2c1b8c18f130d5bacee6de8ce38cd7ec1fa883abfd31b30ece718641d2158

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

class Object
  raise 'Abstract feature branch conflicts with another Ruby library' if respond_to?(:feature_branch)
  def self.feature_branch(feature_name, user_id = nil, &feature_work)
    if feature_enabled?(feature_name, user_id)
      feature_work.call
    end
  end

  raise 'Abstract feature branch conflicts with another Ruby library' if respond_to?(:feature_enabled?)
  def self.feature_enabled?(feature_name, user_id = nil)
    normalized_feature_name = feature_name.to_s.downcase
    AbstractFeatureBranch.application_features[normalized_feature_name] &&
      (user_id.nil? || AbstractFeatureBranch.user_features_storage.sismember("#{AbstractFeatureBranch::ENV_FEATURE_PREFIX}#{normalized_feature_name}", user_id))
  end

  raise 'Abstract feature branch conflicts with another Ruby library' if Object.new.respond_to?(:feature_branch)
  def feature_branch(feature_name, user_id = nil, &feature_work)
    Object.feature_branch(feature_name.to_s, user_id, &feature_work)
  end

  raise 'Abstract feature branch conflicts with another Ruby library' if Object.new.respond_to?(:feature_enabled?)
  def feature_enabled?(feature_name, user_id = nil)
    Object.feature_enabled?(feature_name.to_s, user_id)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abstract_feature_branch-1.1.1 lib/ext/feature_branch.rb
abstract_feature_branch-1.1.0 lib/ext/feature_branch.rb