Sha256: 28ca019036aaf0527d27f448c4515cf87c8f7cd351cb0c325e3b1c7e54f664ec
Contents?: true
Size: 708 Bytes
Versions: 21
Compression:
Stored size: 708 Bytes
Contents
module Flipper module Types class Group < Type def self.wrap(group_or_name) return group_or_name if group_or_name.is_a?(self) Flipper.group(group_or_name) end attr_reader :name def initialize(name, &block) @name = name.to_sym @value = @name if block_given? @block = block @single_argument = @block.arity.abs == 1 else @block = ->(_thing, _context) { false } @single_argument = false end end def match?(thing, context) if @single_argument @block.call(thing) else @block.call(thing, context) end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems