Sha256: b8411e95998c005911590bc7b25d33c9823bcf07f883236c0865f659d65ab705

Contents?: true

Size: 673 Bytes

Versions: 4

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

module RubyLokaliseApi
  module Utils
    module Loaders
      private

      # Instantiates an endpoint
      def endpoint(name:, client: self, params: {})
        klass = RubyLokaliseApi.const_get "Endpoints::#{name}Endpoint"
        klass.new client, params
      end

      # Instantiates a resource
      def resource(name, data)
        klass = RubyLokaliseApi.const_get "Resources::#{name}"
        klass.new data
      end

      # Instantiates a collection
      def collection(name, data)
        klass = RubyLokaliseApi.const_get "Collections::#{name}"
        klass.new data
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-lokalise-api-9.0.1 lib/ruby_lokalise_api/utils/loaders.rb
ruby-lokalise-api-9.0.0 lib/ruby_lokalise_api/utils/loaders.rb
ruby-lokalise-api-8.0.1 lib/ruby_lokalise_api/utils/loaders.rb
ruby-lokalise-api-8.0.0 lib/ruby_lokalise_api/utils/loaders.rb