Class: K8::BaseAction
- Inherits:
-
Object
- Object
- K8::BaseAction
- Defined in:
- lib/keight.rb
Overview
Equivarent to BaseController or AbstractRequestHandler in other framework.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#req ⇒ Object
readonly
Returns the value of attribute req.
-
#resp ⇒ Object
readonly
Returns the value of attribute resp.
-
#sess ⇒ Object
readonly
Returns the value of attribute sess.
Instance Method Summary collapse
- #handle_action(action_name, urlpath_args) ⇒ Object
-
#initialize(req, resp) ⇒ BaseAction
constructor
A new instance of BaseAction.
Constructor Details
#initialize(req, resp) ⇒ BaseAction
Returns a new instance of BaseAction.
678 679 680 681 682 |
# File 'lib/keight.rb', line 678 def initialize(req, resp) #; [!uotpb] accepts request and response objects. @req = req @resp = resp end |
Instance Attribute Details
#req ⇒ Object (readonly)
Returns the value of attribute req.
684 685 686 |
# File 'lib/keight.rb', line 684 def req @req end |
#resp ⇒ Object (readonly)
Returns the value of attribute resp.
684 685 686 |
# File 'lib/keight.rb', line 684 def resp @resp end |
#sess ⇒ Object (readonly)
Returns the value of attribute sess.
684 685 686 |
# File 'lib/keight.rb', line 684 def sess @sess end |
Instance Method Details
#handle_action(action_name, urlpath_args) ⇒ Object
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
# File 'lib/keight.rb', line 686 def handle_action(action_name, urlpath_args) @action_name = action_name @action_args = urlpath_args ex = nil begin #; [!5jnx6] calls '#before_action()' before handling request. before_action() #; [!ddgx3] invokes action method with urlpath params. content = invoke_action(action_name, urlpath_args) #; [!aqa4e] returns content. return handle_content(content) rescue Exception => ex raise ensure #; [!67awf] calls '#after_action()' after handling request. #; [!alpka] calls '#after_action()' even when error raised. after_action(ex) end end |