Module: Omnibus::Sugarable

Included in:
Project, Software
Defined in:
lib/omnibus/sugarable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


33
34
35
36
37
38
39
40
41
42
# File 'lib/omnibus/sugarable.rb', line 33

def self.included(base)
  base.send(:include, Chef::Sugar::DSL)

  if base < Cleanroom
    # Make all the "sugars" available in the cleanroom (DSL)
    Chef::Sugar::DSL.instance_methods.each do |instance_method|
      base.send(:expose, instance_method)
    end
  end
end

Instance Method Details

#nodeObject

This method is used by Chef Sugar to easily add the DSL. By mimicing Chef's node object, we can easily include the existing DSL into Omnibus project as if it were Chef. Otherwise, we would need to rewrite all the DSL methods.


48
49
50
# File 'lib/omnibus/sugarable.rb', line 48

def node
  Ohai
end