Sha256: f24211b2c05b801013cdc2341b1fc86b8a1a074d9211f9f88a37374fb8686f5a

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

class JenkinsCron::Schedule
  attr_reader :name

  def initialize(name, &block)
    @name = name
    @jobs = {}
    instance_eval(&block) if block_given?
  end

  def self.load(name, file_path)
    block = File.read(file_path)
    new(name) { eval(block) }
  end

  def each_jobs
    @jobs.each do |name, job|
      yield job
    end
  end

  def job(job_name, &block)
    if block_given? # initialize
      @jobs[job_name] = JenkinsCron::Job.new(self, job_name, &block)
    else
      @jobs[job_name]
    end
  end

  private

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jenkins_cron-0.0.3 lib/jenkins_cron/schedule.rb
jenkins_cron-0.0.2 lib/jenkins_cron/schedule.rb