Sha256: 030eb9d391976e1604b4e312a934240843d9c9f50c9013fbc29e5adce40a5a91
Contents?: true
Size: 916 Bytes
Versions: 4
Compression:
Stored size: 916 Bytes
Contents
class Chef module DSL # # Module containing a method for each globally declared Resource # # Depends on declare_resource(name, created_at, &block) # # @api private module Resources def self.add_resource_dsl(dsl_name) begin module_eval(<<-EOM, __FILE__, __LINE__+1) def #{dsl_name}(name=nil, created_at=nil, &block) declare_resource(#{dsl_name.inspect}, name, created_at || caller[0], &block) end EOM rescue SyntaxError # Handle the case where dsl_name has spaces, etc. define_method(dsl_name.to_sym) do |name=nil, created_at=nil, &block| declare_resource(dsl_name, name, created_at || caller[0], &block) end end end def self.remove_resource_dsl(dsl_name) remove_method(dsl_name) if method_defined?(dsl_name) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems