Sha256: 2b867728dd6cba8f7eb6b73f5a06304d12cb182694569081c4c0cad90efccb27

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

require 'grape/roar/extensions/relations/adapters/base'
require 'grape/roar/extensions/relations/adapters/active_record'
require 'grape/roar/extensions/relations/adapters/mongoid'

module Grape
  module Roar
    module Extensions
      module Relations
        module Adapters
          def self.for(klass)
            (constants - [:Base]).inject(nil) do |m, c|
              obj = const_get(c)
              obj.valid_for?(klass) ? obj.new(klass) : m
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-roar-0.4.1 lib/grape/roar/extensions/relations/adapters.rb