Module: Berkshelf::Mixin::DSLEval::ClassMethods

Defined in:
lib/berkshelf/mixin/dsl_eval.rb

Instance Method Summary collapse

Instance Method Details

#clean_roomObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/berkshelf/mixin/dsl_eval.rb', line 19

def clean_room
  @clean_room ||= begin
    exposed_methods = self.exposed_methods

    Class.new(DSLEval::CleanRoom) do
      exposed_methods.each do |exposed_method|
        define_method(exposed_method) do |*args, &block|
          instance.send(exposed_method, *args, &block)
        end
      end
    end
  end
end

#expose_method(method) ⇒ Object



33
34
35
# File 'lib/berkshelf/mixin/dsl_eval.rb', line 33

def expose_method(method)
  exposed_methods << method.to_sym
end

#exposed_methodsObject



37
38
39
# File 'lib/berkshelf/mixin/dsl_eval.rb', line 37

def exposed_methods
  @exposed_methods ||= Array.new
end