Module: Workarea::Plugin
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/workarea/plugin.rb,
lib/workarea/plugin/asset_appends_helper.rb
Defined Under Namespace
Modules: AssetAppendsHelper
Class Method Summary
collapse
Class Method Details
.add_append(hash, key, *paths) ⇒ Object
39
40
41
42
|
# File 'lib/workarea/plugin.rb', line 39
def self.add_append(hash, key, *paths)
hash[key] ||= []
hash[key].push(*paths)
end
|
.append_javascripts(*args) ⇒ Object
53
54
55
|
# File 'lib/workarea/plugin.rb', line 53
def self.append_javascripts(*args)
add_append(javascripts_appends, *args)
end
|
.append_partials(*args) ⇒ Object
57
58
59
|
# File 'lib/workarea/plugin.rb', line 57
def self.append_partials(*args)
add_append(partials_appends, *args)
end
|
.append_stylesheets(*args) ⇒ Object
49
50
51
|
# File 'lib/workarea/plugin.rb', line 49
def self.append_stylesheets(*args)
add_append(stylesheets_appends, *args)
end
|
.installed?(search) ⇒ Boolean
13
14
15
16
17
18
19
20
|
# File 'lib/workarea/plugin.rb', line 13
def self.installed?(search)
searches = installed +
installed.map(&:to_s) +
installed.map(&:to_s).map(&:demodulize) +
installed.map(&:slug)
searches.include?(search.to_s)
end
|
.remove_append(hash, key, *paths) ⇒ Object
44
45
46
47
|
# File 'lib/workarea/plugin.rb', line 44
def self.remove_append(hash, key, *paths)
hash[key] ||= []
hash[key].reject! { |path| paths.include?(path) }
end
|
.remove_javascripts(*args) ⇒ Object
65
66
67
|
# File 'lib/workarea/plugin.rb', line 65
def self.remove_javascripts(*args)
remove_append(javascripts_appends, *args)
end
|
.remove_partials(*args) ⇒ Object
69
70
71
|
# File 'lib/workarea/plugin.rb', line 69
def self.remove_partials(*args)
remove_append(partials_appends, *args)
end
|
.remove_stylesheets(*args) ⇒ Object
61
62
63
|
# File 'lib/workarea/plugin.rb', line 61
def self.remove_stylesheets(*args)
remove_append(stylesheets_appends, *args)
end
|
.skip_appends(appends, config) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/workarea/plugin.rb', line 22
def self.skip_appends(appends, config)
return {} if appends.blank?
return appends if config.blank?
Array.wrap(config).each do |line|
if line.respond_to?(:call)
appends = appends.reject { |path| line.call(path) }
elsif line.is_a?(String)
appends = appends - [line]
elsif line.is_a?(Regexp)
appends = appends.reject { |path| line =~ path }
end
end
appends
end
|