Module: ROM::Roda::Plugin

Defined in:
lib/rom/roda/plugin.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.configure(app, *args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rom/roda/plugin.rb', line 4

def self.configure(app, *args)
  args = args.dup

  if args.last.is_a?(Hash) && args.last.key?(:load_path)
    load_path = File.expand_path(args.pop.delete(:load_path), app.opts[:root])
  end

  ROM.setup(*args)

  self.load_files(load_path) if load_path
end

.load_files(path) ⇒ Object



16
17
18
19
20
# File 'lib/rom/roda/plugin.rb', line 16

def self.load_files(path)
  Dir["#{path}/**/*.rb"].each do |class_file|
    require class_file
  end
end