Method: Websitary::Configuration#shortcut

Defined in:
lib/websitary/configuration.rb

#shortcut(symbol, args) ⇒ Object

Define a options shortcut.



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/websitary/configuration.rb', line 321

def shortcut(symbol, args)
    ak = args.keys
    ok = @options.keys
    dk = ok - ak

    # :downloadprocess
    if !ak.include?(:delegate) and
        dk.any? {|e| [:download, :downloadformat, :diff, :format, :diffprocess].include?(e)}
        $logger.warn "Shortcut #{symbol}: Undefined fields: #{dk.inspect}"
    end

    if ak.include?(:delegate)
        dk.each do |field|
            @options[field][symbol] = args[:delegate]
        end
    end

    args.each do |field, val|
        @options[field][symbol] = val unless field == :delegate
    end
end