filesystem-explorer 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,13 +37,13 @@ module FilesystemExplorer
37
37
  private
38
38
 
39
39
  def get_engine_configuration_options
40
- $filesystem_explorer_route_options.each do |path, options|
40
+ FilesystemExplorer::Engine.filesystem_explorer_route_options.each do |path, options|
41
41
  @route = options and break if request.path =~ %r(^#{path})
42
42
  end
43
43
  end
44
44
 
45
45
  def get_engine_configuration_options_by_as(as)
46
- $filesystem_explorer_route_options.each do |path, options|
46
+ FilesystemExplorer::Engine.filesystem_explorer_route_options.each do |path, options|
47
47
  return options if options.as.to_sym == as.to_sym
48
48
  end
49
49
 
@@ -1,5 +1,9 @@
1
1
  module FilesystemExplorer
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace FilesystemExplorer
4
+
5
+ def self.filesystem_explorer_route_options
6
+ @@filesystem_explorer_route_options ||= {}
7
+ end
4
8
  end
5
9
  end
@@ -1,14 +1,6 @@
1
1
  module ActionDispatch
2
2
  module Routing
3
3
  class Mapper
4
- def filesystem_explorer_route_options
5
- if $filesystem_explorer_route_options.is_a?(Hash)
6
- $filesystem_explorer_route_options.empty
7
- else
8
- $filesystem_explorer_route_options = {}
9
- end
10
- end
11
-
12
4
  def filesystem_routes(&block)
13
5
  config_file_path = Rails.root.join('config', 'filesystem_explorer.yml')
14
6
 
@@ -20,7 +12,7 @@ module ActionDispatch
20
12
  end
21
13
  end
22
14
 
23
- block.call(filesystem_explorer_route_options || {}) if block
15
+ block.call(FilesystemExplorer::Engine.filesystem_explorer_route_options || {}) if block
24
16
  end
25
17
 
26
18
  def filesystem_explorer(options = {}, &block)
@@ -33,8 +25,7 @@ module ActionDispatch
33
25
 
34
26
  route_config.instance_eval &block if block
35
27
 
36
- filesystem_explorer_route_options ||= {}
37
- filesystem_explorer_route_options[route_config.url] ||= route_config
28
+ FilesystemExplorer::Engine.filesystem_explorer_route_options[route_config.url] ||= route_config
38
29
 
39
30
  FilesystemExplorer.routes << route_config
40
31
 
@@ -1,3 +1,3 @@
1
1
  module FilesystemExplorer
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filesystem-explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: