# frozen_string_literal: true 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 container[@repository_key] if @repository_key end # @return [{Symbol=>Object}] def to_hash super.merge(repository: @repository_key) end end end end end