Parent

Included Modules

YARD::Handlers::Chef::Base

Base handler for chef elements.

Public Instance Methods

cookbook() click to toggle source

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
lwrp() click to toggle source

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
name() click to toggle source

Gets the name of the handled object.

# File lib/yard-chef/handlers/base.rb, line 33
def name
  statement.parameters.first.jump(:string_content, :ident).source
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.