Module: ROM::Roda::Plugin
- Defined in:
- lib/rom/roda/plugin.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Attribute Summary collapse
-
.environments ⇒ Object
readonly
Returns the value of attribute environments.
Class Method Summary collapse
Class Attribute Details
.environments ⇒ Object (readonly)
Returns the value of attribute environments.
5 6 7 |
# File 'lib/rom/roda/plugin.rb', line 5 def environments @environments end |
Class Method Details
.configure(app, config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rom/roda/plugin.rb', line 7 def configure(app, config) load_paths = [*(config.delete(:load_path) || config.delete(:load_paths))].map do |path| File.( path, app.opts[:root] ) end if config[:load_path] || config[:load_paths] @environments = config.each_with_object({}) do |(env_name, env_config), container| container[env_name] = ROM::Environment.new.tap do |env| env.setup(*[env_config.fetch(:setup)].flatten) env_config.fetch(:plugins, {}).each do |*args| env.use(*args.flatten) end end end load_paths.map { |path| load_files(path) } if load_paths end |
.load_files(path) ⇒ Object
28 29 30 31 32 |
# File 'lib/rom/roda/plugin.rb', line 28 def load_files(path) Dir["#{path}/**/*.rb"].each do |class_file| require class_file end end |