Sha256: c45f9055d927f8dc583355c89bae6cfa9fa1d0315faff7e84df25607e53cd0c3
Contents?: true
Size: 457 Bytes
Versions: 4
Compression:
Stored size: 457 Bytes
Contents
module Dipswitch class Feature attr_reader :name, :gate def initialize(name, gate = nil, &block) @name = name if block_given? @gate = block else @gate = gate end end def on?(*args) @gate.call(*args) end def ==(o) o.class == self.class && o.name == name && o.gate == gate end alias_method :eql?, :== def hash "#{name}_#{gate.hash}".hash end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dipswitch-0.1.4 | lib/dipswitch/feature.rb |
dipswitch-0.1.3 | lib/dipswitch/feature.rb |
dipswitch-0.1.2 | lib/dipswitch/feature.rb |
dipswitch-0.1.1 | lib/dipswitch/feature.rb |