lib/nephos-server/controller.rb in nephos-server-0.2.4 vs lib/nephos-server/controller.rb in nephos-server-0.3.1
- old
+ new
@@ -1,9 +1,9 @@
module Nephos
class Controller
- attr_reader :env, :infos, :callpath
+ attr_reader :env, :infos, :callpath, :params
# @param env [Hash] env extracted from the http request
# @param parsed [Hash] pre-parsed env with parameters, ...
def initialize env={}, parsed={path: [], args: {}}, callpath={params: []}
raise ArgumentError, "env must be a Hash" unless env.is_a? Hash
@@ -14,16 +14,12 @@
raise ArgumentError, "Invalid Callpath. :params must be associated with an Array" unless callpath[:params].is_a? Array
@env= env
@infos= parsed
@callpath= callpath
@params= parsed[:args]
- @params.merge! Params.new(Hash[callpath[:params].zip @infos[:path]])
- @params.select!{|k,v|k}
+ @params.merge! Hash[callpath[:params].zip @infos[:path]]
+ @params.select!{|k,v| not k.to_s.empty?}
+ @params = Params.new(@params)
end
-
- def arguments
- @params
- end
- alias :params :arguments
end
end