Module: Roda::RodaPlugins::Wedge

Defined in:
lib/roda/plugins/wedge.rb

Defined Under Namespace

Modules: InstanceMethods, RequestClassMethods, RequestMethods

Class Method Summary collapse

Class Method Details

.configure(app, opts = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/roda/plugins/wedge.rb', line 4

def self.configure(app, opts = {})
  if app.opts[:wedge]
    app.opts[:wedge].merge!(opts)
  else
    app.opts[:wedge] = opts.dup
  end

  opts = app.opts[:wedge]

  opts.each do |k, v|
    case k.to_s
    when 'plugins'
      v.each { |p| ::Wedge.config.plugin p }
    when 'scope'
      begin
        ::Wedge.config.scope v.new
      rescue
        ::Wedge.config.scope v.new('')
      end
    else
      ::Wedge.config.send(k, v)
    end
  end
end