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.



26
27
28
# File 'lib/roda/plugins/autoforme.rb', line 26

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.



31
32
33
# File 'lib/roda/plugins/autoforme.rb', line 31

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

#inherited(subclass) ⇒ Object

Copy the autoforme configurations into the subclass.



36
37
38
39
# File 'lib/roda/plugins/autoforme.rb', line 36

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