Module: Chef::Mixin::SubclassDirective

Included in:
Provider::Package
Defined in:
lib/chef/mixin/subclass_directive.rb

Instance Method Summary collapse

Instance Method Details

#subclass_directive(sym) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/chef/mixin/subclass_directive.rb', line 22

def subclass_directive(sym)
  define_singleton_method sym do
    instance_variable_set(:"@#{sym}", true)
  end

  define_singleton_method :"#{sym}?" do
    !!instance_variable_get(:"@#{sym}")
  end

  define_method :"#{sym}?" do
    self.class.send(:"#{sym}?")
  end
end