Module: Roda::RodaPlugins::AutoForme::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#autoforme(opts = {}, &block) ⇒ Object

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.



28
29
30
# File 'lib/roda/plugins/autoforme.rb', line 28

def autoforme(opts={}, &block)
  @autoforme_routes[opts[:name]] = ::AutoForme.for(:roda, self, opts, &block).route_proc
end

#autoforme_route(name = nil) ⇒ Object

Retrieve the route proc for the named or default AutoForme.



33
34
35
# File 'lib/roda/plugins/autoforme.rb', line 33

def autoforme_route(name=nil)
  @autoforme_routes[name]
end

#inherited(subclass) ⇒ Object

Copy the autoforme configurations into the subclass.



38
39
40
41
# File 'lib/roda/plugins/autoforme.rb', line 38

def inherited(subclass)
  super
  subclass.instance_variable_set(:@autoforme_routes, @autoforme_routes.dup)
end