Sha256: bccd3b40d34e207799b0683469b74f65e9e99030c986ff3ddf88611b8a7a1181

Contents?: true

Size: 489 Bytes

Versions: 4

Compression:

Stored size: 489 Bytes

Contents

require "forwardable"

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

4 entries across 4 versions & 1 rubygems

Version Path
flipflop-2.7.1 lib/flipflop/facade.rb
flipflop-2.7.0 lib/flipflop/facade.rb
flipflop-2.6.0 lib/flipflop/facade.rb
flipflop-2.5.0 lib/flipflop/facade.rb