Sha256: 56d20bc9e355868eb540b515a4b8b3563b2da9fac76e20da2f091bc0ebe78a22
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true # # Copyright (c) 2020-present, Blue Marble Payroll, LLC # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # require_relative 'string_template' module Burner # Abstract base class for all job subclasses. The only public method a subclass needs to # implement #perform(params, payload, reporter) and then you can register it for use using # the Burner::Jobs factory class method #register. An example of a registration: # Burner::Jobs.register('your_class', YourClass) class Job acts_as_hashable attr_reader :name, :string_template def initialize(name:) raise ArgumentError, 'name is required' if name.to_s.empty? @name = name.to_s @string_template = StringTemplate.instance end private def job_string_template(expression, output, payload) templatable_params = payload.params.merge(__id: output.id, __value: payload.value) string_template.evaluate(expression, templatable_params) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
burner-1.0.0.pre.alpha.5 | lib/burner/job.rb |
burner-1.0.0.pre.alpha.4 | lib/burner/job.rb |