module Roda::RodaPlugins::AutoForme::ClassMethods

  1. lib/roda/plugins/autoforme.rb

Public Instance methods

autoforme(opts={}, &block)

Setup AutoForme for the given Roda class using the given options and block. If the :name option is given, store this configuration for the given name.

[show source]
   # File lib/roda/plugins/autoforme.rb
29 def autoforme(opts={}, &block)
30   framework = @autoforme_frameworks[opts[:name]] = ::AutoForme.for(:roda, self, opts, &block)
31   @autoforme_routes[opts[:name]] = framework.route_proc
32 end
autoforme_framework(name=nil)

Retrieve the framework the named or default AutoForme.

[show source]
   # File lib/roda/plugins/autoforme.rb
35 def autoforme_framework(name=nil)
36   @autoforme_frameworks[name]
37 end
autoforme_route(name=nil)

Retrieve the route proc for the named or default AutoForme.

[show source]
   # File lib/roda/plugins/autoforme.rb
40 def autoforme_route(name=nil)
41   @autoforme_routes[name]
42 end
inherited(subclass)

Copy the autoforme configurations into the subclass.

[show source]
   # File lib/roda/plugins/autoforme.rb
45 def inherited(subclass)
46   super
47   subclass.instance_variable_set(:@autoforme_frameworks, @autoforme_frameworks.dup)
48   subclass.instance_variable_set(:@autoforme_routes, @autoforme_routes.dup)
49 end