Module: SpecificAssets::InstanceMethods

Defined in:
lib/specific_assets/specific_assets.rb

Instance Method Summary collapse

Instance Method Details

#add_css(*asset_name) ⇒ Object



9
10
11
# File 'lib/specific_assets/specific_assets.rb', line 9

def add_css(*asset_name)
  @css_specific += asset_name
end

#add_js(*asset_name) ⇒ Object



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

def add_js(*asset_name)
  @js_specific += asset_name
end

#css_assetsObject

This method is called in view to include all css assets:

css_assets.each { |css| stylesheet_link_tag(css) }


25
26
27
28
29
30
31
# File 'lib/specific_assets/specific_assets.rb', line 25

def css_assets
  unless self.class.css_specific.nil?
    (filter_class_assets("css") + @css_specific).uniq
  else
    @css_specific
  end
end

#initialize_assetsObject



33
34
35
36
# File 'lib/specific_assets/specific_assets.rb', line 33

def initialize_assets
  @js_specific  ||= []
  @css_specific ||= []
end

#js_assetsObject

This method is called in view to include all js assets:

js_assets.each { |js| javascript_include_tag(js) }


15
16
17
18
19
20
21
# File 'lib/specific_assets/specific_assets.rb', line 15

def js_assets
  unless self.class.js_specific.nil?
    (filter_class_assets("js") + @js_specific).uniq
  else
    @js_specific
  end
end