Class: Hanami::Providers::Assets Private
- Inherits:
-
Dry::System::Provider::Source
- Object
- Dry::System::Provider::Source
- Hanami::Providers::Assets
- Defined in:
- lib/hanami/providers/assets.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provider source to register routes helper component in Hanami slices.
Class Method Summary collapse
- .for_slice(slice) ⇒ Object private
- .slice ⇒ Object private
Instance Method Summary collapse
- #prepare ⇒ Object private
- #start ⇒ Object private
Class Method Details
.for_slice(slice) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 |
# File 'lib/hanami/providers/assets.rb', line 14 def self.for_slice(slice) Class.new(self) do |klass| klass.instance_variable_set(:@slice, slice) end end |
Instance Method Details
#prepare ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/hanami/providers/assets.rb', line 26 def prepare require "hanami/assets" end |
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 37 |
# File 'lib/hanami/providers/assets.rb', line 31 def start root = slice.app.root.join("public", "assets", Hanami::Assets.public_assets_dir(slice).to_s) assets = Hanami::Assets.new(config: slice.config.assets, root: root) register(:assets, assets) end |