Sha256: 58b6a927b6f21f64b69be366ede9ff6377652b5bccb1225defea172e7eea7a3a

Contents?: true

Size: 466 Bytes

Versions: 7

Compression:

Stored size: 466 Bytes

Contents

module Flipflop
  module Facade
    extend Forwardable
    delegate [:configure, :enabled?] => :feature_set
    alias_method :on?, :enabled?

    def feature_set
      FeatureSet.current
    end

    def respond_to_missing?(method, include_private = false)
      method[-1] == "?"
    end

    def method_missing(method, *args)
      if method[-1] == "?"
        FeatureSet.current.enabled?(method[0..-2].to_sym)
      else
        super
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
flipflop-2.4.0 lib/flipflop/facade.rb
flipflop-2.3.1 lib/flipflop/facade.rb
flipflop-2.3.0 lib/flipflop/facade.rb
flipflop-2.2.1 lib/flipflop/facade.rb
flipflop-2.2.0 lib/flipflop/facade.rb
flipflop-2.1.0 lib/flipflop/facade.rb
flipflop-2.0.0 lib/flipflop/facade.rb