Sha256: bbaf9d5e043d699143adea0639a10cd3daf074f4e69e9b7c3753c2285db5f071

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

module ActiveGit
  class DbEvent

    def initialize(file_name, working_path=nil)
      @file_name = file_name
      @working_path = working_path || ActiveGit.configuration.working_path
    end

    def synchronize(synchronizer)
      raise 'Must implement in subclass'
    end

    protected

    def model
      @model ||= Inflector.model(@file_name, @working_path)
    end

    def model_id
      Inflector.model_id @file_name
    end

    def data
      json = File.open(@file_name, 'r') { |f| f.readlines.join("\n") }
      model.from_json(json)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_git-0.0.4 lib/active_git/events/db_event.rb