Sha256: ea2f5658ecb89d882b873c3b15b6eb7e8f8edcf754c4b20e57244b2f2acd0889
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true module Hanami # @api private module Providers # Provider source to register routes helper component in Hanami slices. # # @see Hanami::Slice::RoutesHelper # # @api private # @since 2.0.0 class Assets < Dry::System::Provider::Source # @api private def self.for_slice(slice) Class.new(self) do |klass| klass.instance_variable_set(:@slice, slice) end end # @api private def self.slice @slice || Hanami.app end # @api private def prepare require "hanami/assets" end # @api private def start assets_dir = slice.slice_name.to_s unless slice.app.eql?(slice) root = slice.app.root.join("public", "assets", assets_dir.to_s) assets = Hanami::Assets.new(config: slice.config.assets, root: root) register(:assets, assets) end private def slice self.class.slice end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.1.0.rc3 | lib/hanami/providers/assets.rb |