Class: Avo::AssetManager

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::AssetTagHelper
Defined in:
lib/avo/asset_manager.rb

Defined Under Namespace

Classes: JavascriptComponent, StylesheetComponent

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAssetManager

Returns a new instance of AssetManager.



7
8
9
10
11
# File 'lib/avo/asset_manager.rb', line 7

def initialize
  @stylesheets = []
  @javascripts = []
  @stimulus_controllers = {}
end

Instance Attribute Details

#stimulus_controllersObject (readonly)

Returns the value of attribute stimulus_controllers.



5
6
7
# File 'lib/avo/asset_manager.rb', line 5

def stimulus_controllers
  @stimulus_controllers
end

Instance Method Details

#add_javascript(path) ⇒ Object



23
24
25
# File 'lib/avo/asset_manager.rb', line 23

def add_javascript(path)
  @javascripts.push path
end

#add_stylesheet(path) ⇒ Object



19
20
21
# File 'lib/avo/asset_manager.rb', line 19

def add_stylesheet(path)
  @stylesheets.push path
end

#javascriptsObject



35
36
37
# File 'lib/avo/asset_manager.rb', line 35

def javascripts
  @javascripts.uniq
end

#register_stimulus_controller(name, controller) ⇒ Object



27
28
29
# File 'lib/avo/asset_manager.rb', line 27

def register_stimulus_controller(name, controller)
  @stimulus_controllers[name] = controller
end

#resetObject



13
14
15
16
17
# File 'lib/avo/asset_manager.rb', line 13

def reset
  @stylesheets = []
  @javascripts = []
  @stimulus_controllers = {}
end

#stylesheetsObject



31
32
33
# File 'lib/avo/asset_manager.rb', line 31

def stylesheets
  @stylesheets.uniq
end