Module: ActiveSupportDecorators
- Defined in:
- lib/active_support_decorators/version.rb,
lib/active_support_decorators/active_support_decorators.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .auto_decorate_paths ⇒ Object
- .auto_decorate_paths=(path_array) ⇒ Object
- .auto_decorate_provider_paths ⇒ Object
- .auto_decorate_provider_paths=(path_array) ⇒ Object
- .load_path_order(file_name) ⇒ Object
Class Method Details
.auto_decorate_paths ⇒ Object
6 7 8 |
# File 'lib/active_support_decorators/active_support_decorators.rb', line 6 def self.auto_decorate_paths @auto_decorate_paths ||= [] end |
.auto_decorate_paths=(path_array) ⇒ Object
2 3 4 |
# File 'lib/active_support_decorators/active_support_decorators.rb', line 2 def self.auto_decorate_paths=(path_array) @auto_decorate_paths = path_array end |
.auto_decorate_provider_paths ⇒ Object
14 15 16 |
# File 'lib/active_support_decorators/active_support_decorators.rb', line 14 def self.auto_decorate_provider_paths @auto_decorate_provider_paths ||= [] end |
.auto_decorate_provider_paths=(path_array) ⇒ Object
10 11 12 |
# File 'lib/active_support_decorators/active_support_decorators.rb', line 10 def self.auto_decorate_provider_paths=(path_array) @auto_decorate_provider_paths = path_array end |
.load_path_order(file_name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/active_support_decorators/active_support_decorators.rb', line 18 def self.load_path_order(file_name) file_name_order = [file_name] if auto_decorate_paths.any? { |path| file_name.starts_with?(path) } relative_name = file_name.gsub(Rails.root.to_s, '') auto_decorate_provider_paths.each do |path| decorator_file = "#{path}#{relative_name}" if File.file?(decorator_file) || File.file?(decorator_file + '.rb') file_name_order << decorator_file end end end file_name_order end |