class Kamaze::DockerImage::Loader
Loader
for tasks (using eval binding)
Attributes
image[R]
@return [Kamaze::DockerImage]
Public Class Methods
new(image)
click to toggle source
@param [Kamaze::DockerImage] image
# File lib/kamaze/docker_image/loader.rb, line 17 def initialize(image) @image = image.clone.freeze end
Public Instance Methods
call()
click to toggle source
Load tasks.
@return [self]
# File lib/kamaze/docker_image/loader.rb, line 24 def call self.tap do if loadable? context.call do |b| b.local_variable_set(:image, image) b.eval(content) end end end end
loadable?()
click to toggle source
@return [Boolean]
# File lib/kamaze/docker_image/loader.rb, line 36 def loadable? context.dsl? end
Protected Instance Methods
content()
click to toggle source
Tasks file content (to eval)
@return [String]
# File lib/kamaze/docker_image/loader.rb, line 53 def content file.read end
context()
click to toggle source
@return [Module<Context>]
# File lib/kamaze/docker_image/loader.rb, line 58 def context Context end
file()
click to toggle source
@return [Pathname]
# File lib/kamaze/docker_image/loader.rb, line 46 def file Pathname.new(__dir__).join('loader', 'tasks.rb') end