Module: Inflect::Loader
- Defined in:
- lib/inflect/loader.rb
Overview
Responsable for loading all the services for Inflect to comunicate with them and decide wich one will handle the request.
Class Method Summary collapse
-
.locale(path = nil) ⇒ Object
Loads the locale file from the given path Default in Inflect::Configuration.
-
.services(path) ⇒ Array
Loads all the services from the given path, sorted by PRIORITY from lowest (1) to highest (INFINITY).
Class Method Details
.locale(path = nil) ⇒ Object
Loads the locale file from the given path Default in Inflect::Configuration.
31 32 33 |
# File 'lib/inflect/loader.rb', line 31 def self.locale(path = nil) @@locale ||= YAML.load_file(path || Inflect.configuration.locale_path) end |
.services(path) ⇒ Array
Loads all the services from the given path, sorted by PRIORITY from lowest (1) to highest (INFINITY).
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/inflect/loader.rb', line 17 def self.services(path) services = [] Dir["#{path}/*.rb"].each do |file| require "./#{file}" filename = File.basename(file, '.rb') services << Inflect.const_get(filename.camelize).instance end services.sort end |