Sha256: 07339178b6da9720914a1325b5c6735e5c2af65a77151aa74e5e005785dda483
Contents?: true
Size: 676 Bytes
Versions: 5
Compression:
Stored size: 676 Bytes
Contents
module Diesel module Middleware class SetParameterBase def initialize(app, options) @app = app @name = options[:name] @schema = options[:schema] end def call(env) value = find_parameter_value(env) apply_parameter_value(env, value) @app.call(env) end protected def find_parameter_value(env) if @schema @schema.build(@name, env) else context = env[:context] context.get_attribute(@name) end end def apply_parameter_value(env, value) raise NotImplementedError end end end end
Version data entries
5 entries across 5 versions & 1 rubygems