Sha256: 047dc083ae209d6a9d75fb4298ab0d64e9dbda48fc7b554c3bb4ca021c7dfb03
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require "sdbm" require "securerandom" require "date" require 'csv' require "ostruct" require "fileutils" require "oj" require_relative "dddr/sdbm" require_relative "dddr/sequel" require_relative "dddr/version" module Dddr ENTITIES = [] def self.configuration @configuration ||= OpenStruct.new end class Serializer def initialize(engine) @engine = engine end def dump(obj) @engine.dump(obj) end def load(obj) @engine.load(obj) end end def self.configure configuration.env = ENV["DDDR_ENV"] || "development" configuration.data_dir = "/var/dddr" configuration.engine = :sdbm configuration.serializer = Oj configuration.container = nil yield(configuration) if block_given? end class Error < StandardError; end module Entity def self.included(base) if Dddr.configuration.engine == :sdbm puts "Including #{base.name}" Dddr::ENTITIES << base include Dddr::Sdbm base.extend(Dddr::Sdbm::ClassMethods) end if Dddr.configuration.engine == :sequel include Dddr::Sequel base.extend(Dddr::Sdbm::ClassMethods) end end attr_accessor :uid, :created_at, :last_updated_at, :deleted, :deleted_at def new? created_at.nil? end end end Dddr.configure
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dddr-2.0.2 | lib/dddr.rb |
dddr-2.0.1 | lib/dddr.rb |