lib/linked_rails.rb in linked_rails-0.0.4.pre.g9b7bc9073 vs lib/linked_rails.rb in linked_rails-0.0.4.pre.g9e3bcac55
- old
+ new
@@ -20,10 +20,14 @@
module LinkedRails
@model_classes = {}
mattr_accessor :whitelisted_spi_ips
mattr_writer :host, :scheme
+ mattr_accessor :persistent_redis_database, default: ENV['PERSISTENT_REDIS_DATABASE'].presence || 6
+ mattr_accessor :stream_redis_database, default: ENV['STREAM_REDIS_DATABASE'].presence || 7
+ mattr_accessor :cache_redis_database, default: ENV['CACHE_REDIS_DATABASE'].presence || 8
+ mattr_accessor :cache_stream, default: ENV['CACHE_STREAM'].presence || 'transactions'
def self.configurable_class(parent, klass, default: nil, reader: nil) # rubocop:disable Metrics/AbcSize
method = :"#{[parent, klass.to_s.downcase].compact.join('_')}_class"
default ||= "LinkedRails::#{[parent&.to_s&.camelize, klass.to_s.classify].compact.join('::')}"
@@ -48,12 +52,14 @@
def scheme
@@scheme ||= Rails.application.routes.default_url_options[:protocol] || :http # rubocop:disable Style/ClassVars
end
- def iri(**opts)
- RDF::URI.new(**{scheme: LinkedRails.scheme, host: LinkedRails.host}.merge(opts))
+ def iri(**args)
+ opts = {scheme: LinkedRails.scheme, host: LinkedRails.host}.merge(args)
+ opts[:path] = opts[:path].presence || '/'
+ RDF::URI.new(**opts)
end
end
configurable_class(:actions, :item)
configurable_class(:collection, :filter)
@@ -82,10 +88,11 @@
inflect.acronym 'IRI'
inflect.acronym 'RDF'
inflect.acronym 'SHACL'
end
+require 'linked_rails/errors'
require 'linked_rails/uri_template'
require 'linked_rails/vocab'
require 'linked_rails/cache'
require 'linked_rails/enhancements'
require 'linked_rails/model'
@@ -99,5 +106,7 @@
require 'linked_rails/rdf_error'
require 'linked_rails/routes'
require 'linked_rails/serializer'
require 'linked_rails/translate'
require 'linked_rails/railtie'
+require 'linked_rails/url'
+require 'linked_rails/storage'