Sha256: a1e8d6a966f8dc4909894ccadeb0a8b65c8a375e5cdf3c4deff36bb44a410b33

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

module Enygma
  module Adapters
    
    class AbstractAdapter
      
      class InscrutableRecord < StandardError; end
      class InvalidDatabase < StandardError; end
      
      attr_reader :datastore
      
      def connect!(datastore)
        @datastore = nil
      end
      
      def query(args = {})
        []
      end
      
      def get_attribute(record, attribute)
        if record.respond_to?(attribute.to_sym)
          record.__send__(attribute.to_sym)
        elsif record.respond_to?(:[])
          record[attribute]
        else
          raise InscrutableRecord, "Attribute \"#{attribute}\" could not be extracted for record #{record.inspect}."
        end
      end
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sander6-enygma-0.1.0 lib/enygma/adapters/abstract_adapter.rb
sander6-enygma-0.1.1 lib/enygma/adapters/abstract_adapter.rb