Sha256: 93fb0c773132b13976375ba26fa1e7c92e6813663d097de7576767df0b7e0a3d
Contents?: true
Size: 1.24 KB
Versions: 22
Compression:
Stored size: 1.24 KB
Contents
require_relative_all 'repositories' module Locomotive module Steam class Repositories include Morphine attr_accessor_initialize :current_site, :locale, :configuration register :adapter do build_adapter(configuration.adapter) end register :site do SiteRepository.new(adapter, nil, locale) end register :page do PageRepository.new(adapter, current_site, locale) end register :snippet do SnippetRepository.new(adapter, current_site, locale) end register :content_type do ContentTypeRepository.new(adapter, current_site, locale) end register :content_entry do ContentEntryRepository.new(adapter, current_site, locale, content_type) end register :theme_asset do ThemeAssetRepository.new(adapter, current_site, locale) end register :translation do TranslationRepository.new(adapter, current_site, locale) end def build_adapter(options) name = ((options || {})[:name] || :filesystem).to_s require_relative "adapters/#{name.downcase}" klass = "Locomotive::Steam::#{name.camelize}Adapter".constantize klass.new(options) end end end end
Version data entries
22 entries across 22 versions & 1 rubygems