# frozen_string_literal: true require 'roda/endpoints' require 'inflecto' class Roda module Endpoints # Generic HTTP endpoint abstraction. class Endpoint # Accessing data inside of endpoint. module Data # @param name [String] # @param repository [String] # @param attributes [{Symbol=>Object}] def initialize(name:, repository: "repositories.#{Inflecto.pluralize(name)}", **attributes) @repository_key = repository super(name: name, **attributes) end # @return [String] attr_reader :repository_key # @return [ROM::Repository] def repository if @repository_key.is_a?(String) container[@repository_key] else @repository_key end end end end end end