Module: Switcher::ClassMethods

Defined in:
lib/switcher.rb

Instance Method Summary collapse

Instance Method Details

#switcher(name, options = {}, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/switcher.rb', line 9

def switcher(name, options={}, &block)
  self.class_variable_defined?(:@@__specs__) or self.class_variable_set(:@@__specs__, [])

  spec = Spec.new(name, options)
  spec.instance_eval(&block)

  self.class_variable_get(:@@__specs__) << spec

  switcher_pre_initialize(self, spec)
end