YARD::Handlers::Ruby::Base
Base handler for chef elements.
Registers the cookbook in {YARD::Registry} and returns the same.
@return [CookbookObject] the CookbookObject
# File lib/yard-chef/handlers/base.rb, line 41 def cookbook cookbook_name = "" path_array = File.expand_path(statement.file).to_s.split('/') if path_array.include?('metadata.rb') cookbook_name = path_array[path_array.index('metadata.rb') - 1] else cookbook_name = path_array[path_array.length - 3] end ChefObject.register(CHEF, cookbook_name, :cookbook) end
Registers the lightweight resource and provider in YARD::Registry and returns the same.
@return [ResourceObject or ProviderObject] the lightweight resource or provider
# File lib/yard-chef/handlers/base.rb, line 58 def lwrp path_array = File.expand_path(statement.file).to_s.split('/') if path_array.include?("resources") type = RESOURCE type_sym = :resource elsif path_array.include?("providers") type = PROVIDER type_sym = :provider else raise "Invalid LWRP type #{@path_array.join(',')}" end file_name = path_array.last.to_s.sub('.rb','') cookbook_obj = cookbook if file_name == "default" lwrp_name = cookbook_obj.name else lwrp_name = "#{cookbook_obj.name}_#{file_name}" end ChefObject.register(type, lwrp_name, type_sym) end
Generated with the Darkfish Rdoc Generator 2.