module Resourcerer::Controller::ClassMethods
Public Instance Methods
resource(name, **options, &block)
click to toggle source
Public: Defines a Resource
in a controller Class.
name - The name of the method to define. **options - See Resource#initialize for details. block - If supplied, the block is executed to provide options.
Returns the name of the defined resource.
# File lib/resourcerer/controller.rb, line 31 def resource(name, **options, &block) Resource.define(self, name, **options, &block) end
resourcerer_config(name, **options, &block)
click to toggle source
Public: Defines a Configuration
preset that can be reused in different Resources by providing the :using option.
name - The Symbol name of the configuration preset. options - The Hash of options to define the preset. block - If supplied, the block is executed to provide options.
Returns a Hash with all the resource configurations.
# File lib/resourcerer/controller.rb, line 43 def resourcerer_config(name, **options, &block) self.resourcerer_configuration = (resourcerer_configuration || {}).merge( name => Configuration.new(options, &block) ) end