Class: Track::Controller
- Inherits:
-
Object
- Object
- Track::Controller
- Defined in:
- lib/track/controller.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
- .after_filter(method, options = {}) ⇒ Object
- .before_filter(method, options = {}) ⇒ Object
- .filters ⇒ Object
Instance Method Summary collapse
-
#initialize(env, params) ⇒ Controller
constructor
A new instance of Controller.
- #respond(response) ⇒ Object
- #run_filters(kind, action) ⇒ Object
Constructor Details
#initialize(env, params) ⇒ Controller
Returns a new instance of Controller.
11 12 13 14 |
# File 'lib/track/controller.rb', line 11 def initialize(env, params) @env = env @params = params end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
9 10 11 |
# File 'lib/track/controller.rb', line 9 def env @env end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
9 10 11 |
# File 'lib/track/controller.rb', line 9 def params @params end |
Class Method Details
.after_filter(method, options = {}) ⇒ Object
38 39 40 |
# File 'lib/track/controller.rb', line 38 def after_filter(method, = {}) @@filters.add(self, :after, method, ) end |
.before_filter(method, options = {}) ⇒ Object
34 35 36 |
# File 'lib/track/controller.rb', line 34 def before_filter(method, = {}) @@filters.add(self, :before, method, ) end |
.filters ⇒ Object
30 31 32 |
# File 'lib/track/controller.rb', line 30 def filters @@filters end |
Instance Method Details
#respond(response) ⇒ Object
24 25 26 |
# File 'lib/track/controller.rb', line 24 def respond(response) @_response = response end |
#run_filters(kind, action) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/track/controller.rb', line 16 def run_filters(kind, action) @@filters.scan(self.class, kind, action).each do |filter_method| self.send(filter_method) return @_response if @_response end nil end |