Class: Flipper::Types::Group

Inherits:
Flipper::Type show all
Defined in:
lib/flipper/types/group.rb

Instance Attribute Summary collapse

Attributes inherited from Flipper::Type

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Flipper::Type

#eql?

Constructor Details

#initialize(name, &block) ⇒ Group

Returns a new instance of Group.



11
12
13
14
15
# File 'lib/flipper/types/group.rb', line 11

def initialize(name, &block)
  @name = name.to_sym
  @value = @name
  @block = block
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/flipper/types/group.rb', line 9

def name
  @name
end

Class Method Details

.wrap(group_or_name) ⇒ Object



4
5
6
7
# File 'lib/flipper/types/group.rb', line 4

def self.wrap(group_or_name)
  return group_or_name if group_or_name.is_a?(self)
  Flipper.group(group_or_name)
end

Instance Method Details

#match?(*args) ⇒ Boolean

Returns:



17
18
19
# File 'lib/flipper/types/group.rb', line 17

def match?(*args)
  @block.call(*args) == true
end