Sha256: 3130b1e8a8d2ffd2828307fac1b4ab7901415e08cc6e60b03724d0b720601da3

Contents?: true

Size: 497 Bytes

Versions: 3

Compression:

Stored size: 497 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

3 entries across 3 versions & 1 rubygems

Version Path
flip_fab-1.0.1 lib/flip_fab/feature.rb
flip_fab-1.0.0 lib/flip_fab/feature.rb
flip_fab-0.0.1 lib/flip_fab/feature.rb