class Goliath::Rack::Validation::RequiredParam
def initialize(app, opts = {})
-
(Goliath::Rack::Validation::RequiredParam)
- The validator
Options Hash:
(**opts)
-
:message
(String
) -- The message string to display after the type string. (default: 'identifier missing') -
:type
(String
) -- The type string to put in the error message. (default: :key) -
:key
(String
) -- The key to look for in params (default: id)
Parameters:
-
opts
(Hash
) -- The validator options -
app
() -- The app object
def initialize(app, opts = {}) @app = app @key = opts[:key] || 'id' @type = opts[:type] || @key @message = opts[:message] || 'identifier missing' if @key.is_a?(String) && @key.include?('.') @key = @key.split('.') end end