Module: Roda::RodaPlugins::Path::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#path(name, path = nil, &block) ⇒ Object

Raises:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/roda/plugins/path.rb', line 22

def path(name, path=nil, &block)
  raise RodaError,  "cannot provide both path and block to Roda.path" if path && block
  raise RodaError,  "must provide either path or block to Roda.path" unless path || block

  if path
    path = path.dup.freeze
    block = lambda{path}
  end

  define_method("#{name}_path", &block)
end