Module: ActiveSupport::Slices
- Extended by:
- Slices
- Included in:
- Slices
- Defined in:
- lib/active_support/slices.rb,
lib/activesupport_slices/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#load(filename) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/active_support/slices.rb', line 14 def load(filename) filename = local(filename) if slices.key?(filename) slices[filename].each { |slice| Dependencies.load(slice) } end end |
#local(path) ⇒ Object
29 30 31 |
# File 'lib/active_support/slices.rb', line 29 def local(path) path.sub(pattern, '') end |
#paths ⇒ Object
10 11 12 |
# File 'lib/active_support/slices.rb', line 10 def paths Dependencies.autoload_paths end |
#pattern ⇒ Object
33 34 35 |
# File 'lib/active_support/slices.rb', line 33 def pattern @pattern || %r((#{paths.join('|')})/) end |
#register ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/active_support/slices.rb', line 21 def register Dir["{#{paths.join(',')}}/**/*_slice*.rb"].sort.each do |path| filename = local(path).sub('_slice', '') slices[filename] ||= [] slices[filename] << path end end |