Sha256: f0f161a55a17768851805cf9655eb149a175ec3b3476b3b75e671ebd211ace62

Contents?: true

Size: 500 Bytes

Versions: 8

Compression:

Stored size: 500 Bytes

Contents

module FlipFab
  class Feature
    attr_reader :name, :default, :persistence_adapters

    def initialize(name, options = {})
      @name                 = name
      @default              = options[:default] || :disabled
      @persistence_adapters = options[:persistence_adapters] || [CookiePersistence]
    end

    def enabled?
      default == :enabled
    end

    def disabled?
      !enabled?
    end

    def with_context(context)
      ContextualFeature.new self, context
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flip_fab-1.1.21 lib/flip_fab/feature.rb
flip_fab-1.1.20 lib/flip_fab/feature.rb
flip_fab-1.1.19 lib/flip_fab/feature.rb
flip_fab-1.1.18 lib/flip_fab/feature.rb
flip_fab-1.0.18 lib/flip_fab/feature.rb
flip_fab-1.0.17 lib/flip_fab/feature.rb
flip_fab-1.0.16 lib/flip_fab/feature.rb
flip_fab-1.0.2 lib/flip_fab/feature.rb