Module: Strelka::App::Parameters::ClassMethods
- Defined in:
- lib/strelka/app/parameters.rb
Overview
Class methods to add to classes with routing.
Instance Attribute Summary collapse
-
#paramvalidator ⇒ Object
readonly
Returns the value of attribute paramvalidator.
Instance Method Summary collapse
-
#inherited(subclass) ⇒ Object
Inheritance hook – inheriting classes inherit their parents’ parameter declarations, too.
-
#param(name, *args, &block) ⇒ Object
:call-seq: param( name, *flags ) param( name, constraint, *flags ) param( name, description, *flags ) param( name, constraint, description, *flags ).
Instance Attribute Details
#paramvalidator ⇒ Object (readonly)
Returns the value of attribute paramvalidator.
84 85 86 |
# File 'lib/strelka/app/parameters.rb', line 84 def paramvalidator @paramvalidator end |
Instance Method Details
#inherited(subclass) ⇒ Object
Inheritance hook – inheriting classes inherit their parents’ parameter declarations, too.
105 106 107 108 109 |
# File 'lib/strelka/app/parameters.rb', line 105 def inherited( subclass ) super subclass.instance_variable_set( :@paramvalidator, self.paramvalidator.dup ) self.log.debug "Adding param validator: %p" % [ self.paramvalidator ] end |
#param(name, *args, &block) ⇒ Object
:call-seq:
param( name, *flags )
param( name, constraint, *flags )
param( name, description, *flags )
param( name, constraint, description, *flags )
Declare a parameter with the specified name that will be validated using the given constraint. The constraint can be any of the types supported by Strelka::ParamValidator.
96 97 98 99 100 |
# File 'lib/strelka/app/parameters.rb', line 96 def param( name, *args, &block ) self.log.debug "New param %p" % [ name ] self.log.debug " adding parameter %p to %p" % [ name, self.paramvalidator ] self.paramvalidator.add( name, *args, &block ) end |