lib/roda/plugins/typecast_params.rb
def process(meth, key, default)
          v = param_value(key)

          unless v.nil?
            check_null_byte(v)
            v = send(meth, v)
          end

          if v.nil?
            if default == CHECK_NIL
              handle_error(key, :missing, "missing parameter for #{param_name(key)}")
            end

            default
          else
            v
          end
        rescue => e
          handle_error(key, meth.to_s.sub(/\A_?convert_/, '').to_sym, e)
        end
# Get the value of +key+ for the object, and convert it to the expected type using +meth+.
# If the value either before or after conversion is nil, return the +default+ value.
Get the value of +key+ for the object, and convert it to the expected type using +meth+.
If the value either before or after conversion is nil, return the +default+ value.
Get the value of + key + for the object and convert it to the expected type using + meth + . If the value either before or after conversion is nil return the + default + value .
def process(meth, key, default)
          v = param_value(key)
          unless v.nil?
            check_null_byte(v)
            v = send(meth, v)
          end
          if v.nil?
            if default == CHECK_NIL
              handle_error(key, :missing, "missing parameter for #{param_name(key)}")
            end
            default
          else
            v
          end
        rescue => e
          handle_error(key, meth.to_s.sub(/\A_?convert_/, '').to_sym, e)
        end
def process ( meth , key , default ) v = param_value ( key ) unless v . nil? check_null_byte ( v ) v = send ( meth , v ) end if v . nil? if default == CHECK_NIL handle_error ( key , :missing , "missing parameter for #{param_name(key)}" ) end default else v end rescue => e handle_error ( key , meth . to_s . sub ( / \A _?convert_ / , '' ) . to_sym , e ) end
Get the value of +key+ for the object, and convert it to the expected type using +meth+.
Get the value of + key + for the object and convert it to the expected type using + meth + .
meth
key
default