Class: Whiskey::Server::Interpretor
- Inherits:
-
Object
- Object
- Whiskey::Server::Interpretor
- Defined in:
- lib/whiskey/server/interpretor.rb
Instance Method Summary collapse
-
#initialize(input) ⇒ Interpretor
constructor
A new instance of Interpretor.
- #instruction ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(input) ⇒ Interpretor
Returns a new instance of Interpretor.
4 5 6 7 8 9 10 11 |
# File 'lib/whiskey/server/interpretor.rb', line 4 def initialize(input) @instruction = input @response = if has_resource? && has_verb? Router.new(instruction.resource, instruction.verb, instruction.parameters) else Error.new(:not_found) end end |
Instance Method Details
#instruction ⇒ Object
17 18 19 |
# File 'lib/whiskey/server/interpretor.rb', line 17 def instruction OpenStruct.new(@instruction) end |
#response ⇒ Object
13 14 15 |
# File 'lib/whiskey/server/interpretor.rb', line 13 def response @response.to_hash end |