Class: YARD::Handlers::Chef::ActionHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/yard-chef/handlers/action.rb

Overview

Handles “action” in a provider.

Instance Method Summary collapse

Methods inherited from Base

#cookbook, #lwrp, #name

Instance Method Details

#processObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/yard-chef/handlers/action.rb', line 31

def process
  # Register the provider object
  provider_obj = lwrp
  provider_obj.map_resource(statement.file)
  provider_obj.add_file(statement.file)

  # Add provider to the cookbook to which it belongs
  cookbook_obj = cookbook
  unless cookbook_obj.providers.include?(provider_obj)
    cookbook_obj.providers.push(provider_obj)
  end
  provider_obj.cookbook = cookbook_obj

  # Register the action in the provider
  action_obj = ChefObject.register(provider_obj, name, :action)
  action_obj.source = statement.source
  action_obj.docstring = statement.docstring
  action_obj.add_file(statement.file, statement.line)
end