lib/deas/runner.rb in deas-0.24.0 vs lib/deas/runner.rb in deas-0.24.1
- old
+ new
@@ -1,5 +1,7 @@
+require 'rack/utils'
+
module Deas
class Runner
attr_reader :handler_class, :handler
@@ -16,9 +18,31 @@
def status(*args); raise NotImplementedError; end
def headers(*args); raise NotImplementedError; end
def render(*args); raise NotImplementedError; end
def partial(*args); raise NotImplementedError; end
def send_file(*args); raise NotImplementedError; end
+
+ class NormalizedParams
+
+ attr_reader :value
+
+ def initialize(value)
+ @value = if value.is_a?(::Array)
+ value.map{ |i| self.class.new(i).value }
+ elsif Rack::Utils.params_hash_type?(value)
+ value.inject({}){ |h, (k, v)| h[k.to_s] = self.class.new(v).value; h }
+ elsif self.file_type?(value)
+ value
+ else
+ value.to_s
+ end
+ end
+
+ def file_type?(value)
+ raise NotImplementedError
+ end
+
+ end
end
end