Class: Avo::AssetManager

Inherits:
Object
  • Object
show all
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.



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

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

Instance Attribute Details

#stimulus_controllersObject (readonly)

Returns the value of attribute stimulus_controllers.



3
4
5
# File 'lib/avo/asset_manager.rb', line 3

def stimulus_controllers
  @stimulus_controllers
end

Instance Method Details

#add_javascript(path) ⇒ Object



21
22
23
# File 'lib/avo/asset_manager.rb', line 21

def add_javascript(path)
  @javascripts.push path
end

#add_stylesheet(path) ⇒ Object



17
18
19
# File 'lib/avo/asset_manager.rb', line 17

def add_stylesheet(path)
  @stylesheets.push path
end

#javascriptsObject



33
34
35
# File 'lib/avo/asset_manager.rb', line 33

def javascripts
  @javascripts.uniq
end

#register_stimulus_controller(name, controller) ⇒ Object



25
26
27
# File 'lib/avo/asset_manager.rb', line 25

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

#resetObject



11
12
13
14
15
# File 'lib/avo/asset_manager.rb', line 11

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

#stylesheetsObject



29
30
31
# File 'lib/avo/asset_manager.rb', line 29

def stylesheets
  @stylesheets.uniq
end