Sha256: bba02127d20eba2407e8577bd5ed2bd87b0e2234b740b58bf543d07f20c58ca3
Contents?: true
Size: 589 Bytes
Versions: 1
Compression:
Stored size: 589 Bytes
Contents
require 'lazy_const' class FeatureDefinitions extend LazyConst attr_reader :test_proc def self.define_feature(name, &block) lazy_const(name) { new(&block) } end PASSTHROUGH = Proc.new { |arg| arg } def initialize(&block) if block_given? @test_proc = block.to_proc else @test_proc = PASSTHROUGH end end @@context = nil def self.context=(context) @@context = context end def context @@context end def enabled?(&block) test_proc.call(context).tap do |verdict| yield if verdict and block_given? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
feature_definitions-0.3.0 | lib/feature_definitions.rb |