lib/chronicle/etl/job_log.rb in chronicle-etl-0.2.3 vs lib/chronicle/etl/job_log.rb in chronicle-etl-0.2.4

- old
+ new

@@ -1,22 +1,26 @@ -require 'pry' +require 'forwardable' module Chronicle module ETL # A record of what happened in the running of a job. We're interested in # tracking when it ran, if it was successful, and what the latest record # we found is (to use as a cursor for the next time) class JobLog + extend Forwardable + attr_accessor :job, :job_id, :last_id, :highest_timestamp, :num_records_processed, :started_at, :finished_at, :success + def_delegators :@job, :save_log? + # Create a new JobLog for a given Job def initialize @num_records_processed = 0 @success = false yield self if block_given? @@ -61,9 +65,11 @@ started_at: @started_at, finished_at: @finished_at, success: @success } end + + private # Create a new JobLog and set its instance variables from a serialized hash def self.build_from_serialized attrs attrs.delete(:id) new do |job_log|