Class: Nephos::Controller
- Inherits:
-
Object
- Object
- Nephos::Controller
- Defined in:
- lib/nephos-server/controller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#callpath ⇒ Object
readonly
Returns the value of attribute callpath.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#infos ⇒ Object
readonly
Returns the value of attribute infos.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(env = {}, parsed = {path: [], args: {}}, callpath = {params: []}) ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize(env = {}, parsed = {path: [], args: {}}, callpath = {params: []}) ⇒ Controller
Returns a new instance of Controller.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nephos-server/controller.rb', line 8 def initialize env={}, parsed={path: [], args: {}}, callpath={params: []} raise ArgumentError, "env must be a Hash" unless env.is_a? Hash raise ArgumentError, "parsed must be a Hash" unless parsed.is_a? Hash raise ArgumentError, "callpath must be a Hash" unless callpath.is_a? Hash raise ArgumentError, "Invalid Parsed. :path must be associated with an Array" unless parsed[:path].is_a? Array raise ArgumentError, "Invalid Parsed. :args must be associated with a Hash" unless parsed[:args].is_a? Hash 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! Hash[callpath[:params].zip @infos[:path]] @params.select!{|k,v| not k.to_s.empty?} @params = Params.new(@params) end |
Instance Attribute Details
#callpath ⇒ Object (readonly)
Returns the value of attribute callpath.
4 5 6 |
# File 'lib/nephos-server/controller.rb', line 4 def callpath @callpath end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
4 5 6 |
# File 'lib/nephos-server/controller.rb', line 4 def env @env end |
#infos ⇒ Object (readonly)
Returns the value of attribute infos.
4 5 6 |
# File 'lib/nephos-server/controller.rb', line 4 def infos @infos end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/nephos-server/controller.rb', line 4 def params @params end |