Class: Puppet::DSL::ResourceTypeAPI
- Defined in:
- lib/vendor/puppet/dsl/resource_type_api.rb
Overview
Type of the objects inside of which pure ruby manifest files are executed. Provides methods for creating defines, hostclasses, and nodes.
Instance Method Summary collapse
- #define(name, *args, &block) ⇒ Object
- #hostclass(name, options = {}, &block) ⇒ Object
-
#initialize ⇒ ResourceTypeAPI
constructor
A new instance of ResourceTypeAPI.
- #node(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ ResourceTypeAPI
Returns a new instance of ResourceTypeAPI.
7 8 9 |
# File 'lib/vendor/puppet/dsl/resource_type_api.rb', line 7 def initialize @__created_ast_objects__ = [] end |
Instance Method Details
#define(name, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vendor/puppet/dsl/resource_type_api.rb', line 11 def define(name, *args, &block) args = args.inject([]) do |result, item| if item.is_a?(Hash) item.each { |p, v| result << [p, v] } else result << item end result end @__created_ast_objects__.push Puppet::Parser::AST::Definition.new(name, {:arguments => args}, &block) nil end |