class YARD::CodeObjects::Chef::ProviderObject
A ProviderObject
represents a lightweight provider in Chef
. See docs.opscode.com/essentials_cookbook_lwrp.html
Public Class Methods
new(namespace, name)
click to toggle source
Creates a new instance of ProviderObject
.
@param namespace [NamespaceObject] namespace to which the lightweight provider belongs @param name [String] name of the lightweight provider
@return [ProviderObject] the newly created ProviderObject
Calls superclass method
YARD::CodeObjects::Chef::ChefObject::new
# File lib/yard-chef/code_objects/provider_object.rb, line 40 def initialize(namespace, name) super(namespace, name) @description = '' end
Public Instance Methods
actions()
click to toggle source
Actions implemented in the lightweight provider.
@return [Array<ActionObject>] actions in the provider
# File lib/yard-chef/code_objects/provider_object.rb, line 81 def actions children_by_type(:action) end
long_name()
click to toggle source
Constructs class name for the lightweight provider.
@return [String] the class name for the lightweight provider
# File lib/yard-chef/code_objects/provider_object.rb, line 49 def long_name name = '' if @name.to_s =~ /_/ @name.to_s.split('_').each do |str| name << str.to_s.capitalize end else name = @name.to_s.capitalize end namespace = @namespace.to_s.split('::').map(&:capitalize) "#{namespace.join('::')}::#{name}" end
map_resource(file)
click to toggle source
Maps provider with a lightweight resource.
@param [String] path to the lightweight provider file.
# File lib/yard-chef/code_objects/provider_object.rb, line 66 def map_resource(file) file_handle = File.open(File.expand_path(file), 'r') file_handle.readlines.each do |line| next unless line =~ /#\s@resource/ resource_name = line.split(/@resource /)[1].strip @resource = ChefObject.register(RESOURCE, resource_name, :resource) @resource.providers.push(self) unless @resource.providers.include?(self) break end end