Class: RailsDevtools::AssetConfig
- Inherits:
-
Object
- Object
- RailsDevtools::AssetConfig
- Defined in:
- lib/rails_devtools/asset_config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #helper_snippet ⇒ Object
- #implicit_path ⇒ Object
-
#initialize(providers) ⇒ AssetConfig
constructor
A new instance of AssetConfig.
- #paths ⇒ Object
- #vite_rails? ⇒ Boolean
Constructor Details
#initialize(providers) ⇒ AssetConfig
Returns a new instance of AssetConfig.
10 11 12 |
# File 'lib/rails_devtools/asset_config.rb', line 10 def initialize(providers) @providers = providers end |
Class Method Details
.find ⇒ Object
5 6 7 8 |
# File 'lib/rails_devtools/asset_config.rb', line 5 def self.find providers = AssetProvider.new.list new(providers) end |
Instance Method Details
#helper_snippet ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rails_devtools/asset_config.rb', line 18 def helper_snippet if vite_rails? "vite_image_tag" else "image_tag" end end |
#implicit_path ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/rails_devtools/asset_config.rb', line 26 def implicit_path if vite_rails? "" else "images/" end end |
#paths ⇒ Object
14 15 16 |
# File 'lib/rails_devtools/asset_config.rb', line 14 def paths @paths ||= @providers.flat_map(&:paths) end |
#vite_rails? ⇒ Boolean
34 35 36 |
# File 'lib/rails_devtools/asset_config.rb', line 34 def vite_rails? @providers.any? { |p| p.provider == :vite_rails } end |