Class: FeatureRich::GroupFeature

Inherits:
FeatureHandler show all
Defined in:
lib/feature-rich/group_feature.rb

Instance Attribute Summary collapse

Attributes inherited from FeatureHandler

#disabled, #label, #name

Instance Method Summary collapse

Methods inherited from FeatureHandler

#disabled?

Constructor Details

#initialize(group_name, options = {}) ⇒ GroupFeature

Returns a new instance of GroupFeature.



6
7
8
9
# File 'lib/feature-rich/group_feature.rb', line 6

def initialize(group_name, options = {})
  super
  @sets = []
end

Instance Attribute Details

#setsObject

Returns the value of attribute sets.



4
5
6
# File 'lib/feature-rich/group_feature.rb', line 4

def sets
  @sets
end

Instance Method Details

#configure(&block) ⇒ Object



23
24
25
26
# File 'lib/feature-rich/group_feature.rb', line 23

def configure(&block)
  instance_exec(&block)
  self
end

#feature(name, options = {}) ⇒ Object



19
20
21
# File 'lib/feature-rich/group_feature.rb', line 19

def feature(name, options = {})
  sets << FeatureRich::FeatureHandler.new(name.to_sym, options)
end

#namesObject



15
16
17
# File 'lib/feature-rich/group_feature.rb', line 15

def names
  sets.map(&:name)
end

#subset?(ary) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/feature-rich/group_feature.rb', line 11

def subset?(ary)
  (names & ary) == names
end