Sha256: 29d9b715aa1176b8439bbd0cafc6cfd798cf0102c7b649838732b2b6af7b0a2e

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 Bytes

Contents

# frozen_string_literal: true

require 'delegate'

module SnFoil
  module Adapters
    module ORMs
      class BaseAdapter < SimpleDelegator
        def new(**_params)
          raise NotImplementedError, '#new not implemented in adapter'
        end

        def all
          raise NotImplementedError, '#all not implemented in adapter'
        end

        def save
          raise NotImplementedError, '#save not implemented in adapter'
        end

        def destroy
          raise NotImplementedError, '#destroy not implemented in adapter'
        end

        def attributes=(_attributes)
          raise NotImplementedError, '#attributes= not implemented in adapter'
        end

        def is_a?(check_class)
          __getobj__.class.object_id.equal?(check_class.object_id)
        end

        def klass
          __getobj__.class
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snfoil-0.8.5 lib/sn_foil/adapters/orms/base_adapter.rb
snfoil-0.8.4 lib/sn_foil/adapters/orms/base_adapter.rb
snfoil-0.8.3 lib/sn_foil/adapters/orms/base_adapter.rb