class Berkshelf::API::CacheBuilder::Worker::Base

Attributes

options[R]
priority[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/berkshelf/api/cache_builder/worker.rb, line 21
def initialize(options = {})
  @priority = options[:priority]
end
worker_type(type = nil) click to toggle source

@param [#to_s, nil] type

# File lib/berkshelf/api/cache_builder/worker.rb, line 7
def worker_type(type = nil)
  return @worker_type if @worker_type
  @worker_type = type.to_s
  Worker.register(@worker_type, self)
end

Public Instance Methods

cookbooks() click to toggle source

@abstract

@return [Array<RemoteCookbook>]

The list of cookbooks this builder can find
# File lib/berkshelf/api/cache_builder/worker.rb, line 43
def cookbooks
  raise RuntimeError, "must be implemented"
end
metadata(remote) click to toggle source

@abstract

@param [RemoteCookbook] remote

@return [Ridley::Chef::Cookbook::Metadata]

# File lib/berkshelf/api/cache_builder/worker.rb, line 35
def metadata(remote)
  raise RuntimeError, "must be implemented"
end
to_s() click to toggle source

@return [String]

# File lib/berkshelf/api/cache_builder/worker.rb, line 26
def to_s
  friendly_name
end

Private Instance Methods

friendly_name(data = nil) click to toggle source

@param [String] data

any string to append to the worker_type

@return [String]

# File lib/berkshelf/api/cache_builder/worker.rb, line 52
def friendly_name(data = nil)
  string = self.class.worker_type.dup
  string << ": #{data}" if data
  string
end