Skip to content

Commit 5a627d8

Browse files
Fix namespacing
1 parent 71e7017 commit 5a627d8

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/critical-path-css-rails.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module CriticalPathCss
66
CACHE_NAMESPACE = 'critical-path-css'
77

88
def self.generate(route)
9-
Rails.cache.write(
9+
::Rails.cache.write(
1010
route,
1111
CssFetcher.new(config).fetch_route(route),
1212
namespace: CACHE_NAMESPACE,
@@ -16,20 +16,20 @@ def self.generate(route)
1616

1717
def self.generate_all
1818
CssFetcher.new(config).fetch.each do |route, css|
19-
Rails.cache.write(route, css, namespace: CACHE_NAMESPACE, expires_in: nil)
19+
::Rails.cache.write(route, css, namespace: CACHE_NAMESPACE, expires_in: nil)
2020
end
2121
end
2222

2323
def self.clear(route)
24-
Rails.cache.delete(route, namespace: CACHE_NAMESPACE)
24+
::Rails.cache.delete(route, namespace: CACHE_NAMESPACE)
2525
end
2626

2727
def self.clear_matched(routes)
28-
Rails.cache.delete_matched(routes, namespace: CACHE_NAMESPACE)
28+
::Rails.cache.delete_matched(routes, namespace: CACHE_NAMESPACE)
2929
end
3030

3131
def self.fetch(route)
32-
Rails.cache.read(route, namespace: CACHE_NAMESPACE) || ''
32+
::Rails.cache.read(route, namespace: CACHE_NAMESPACE) || ''
3333
end
3434

3535
def self.config

lib/critical_path_css/rails/config_loader.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module CriticalPathCss
22
module Rails
3-
module ConfigLoader
3+
class ConfigLoader
44
CONFIGURATION_FILENAME = 'critical_path_css.yml'
55

66
def load
7-
config = YAML.load(ERB.new(File.read(configuration_file_path)).result)[Rails.env]
8-
config['css_path'] = "#{Rails.root}/public" + (
7+
config = YAML.load(ERB.new(File.read(configuration_file_path)).result)[::Rails.env]
8+
config['css_path'] = "#{::Rails.root}/public" + (
99
config['css_path'] ||
1010
ActionController::Base.helpers.stylesheet_path(
1111
config['manifest_name'], host: ''
@@ -17,7 +17,7 @@ def load
1717
private
1818

1919
def configuration_file_path
20-
@configuration_file_path ||= Rails.root.join('config', CONFIGURATION_FILENAME)
20+
@configuration_file_path ||= ::Rails.root.join('config', CONFIGURATION_FILENAME)
2121
end
2222
end
2323
end

0 commit comments

Comments
 (0)