lib/roda/endpoints/endpoint/data.rb in roda-endpoints-0.3.0 vs lib/roda/endpoints/endpoint/data.rb in roda-endpoints-0.3.1

- old
+ new

@@ -1,7 +1,10 @@ # frozen_string_literal: true +require 'roda/endpoints' +require 'inflecto' + class Roda module Endpoints # Generic HTTP endpoint abstraction. class Endpoint # Accessing data inside of endpoint. @@ -19,15 +22,14 @@ # @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) + if @repository_key.is_a?(String) + container[@repository_key] + else + @repository_key + end end end end end end