rango 0.1.1.2.2 → 0.1.1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,11 +20,18 @@ module Rango
20
20
  end
21
21
 
22
22
  def to_response
23
- method = self.request.env["rango.controller.action"].to_sym
24
- unless self.respond_to?(method) # TODO: what about method_missing?
23
+ method = request.env["rango.controller.action"].to_sym
24
+ if self.respond_to?(method) # TODO: what about method_missing?
25
+ self.process_action(method)
26
+ else
25
27
  raise NotFound, "Controller #{self.class.name} doesn't have method #{method}"
26
28
  end
27
- self.run_filters(:before, method.to_sym)
29
+ return self.response.finish
30
+ rescue HttpError => exception
31
+ self.rescue_http_error(exception)
32
+ end
33
+
34
+ def process_action(method)
28
35
  # If you don't care about arguments or if you prefer usage of params.
29
36
  if self.method(method).arity.eql?(0)
30
37
  Rango.logger.debug("Calling method #{self.class.name}##{method} without arguments")
@@ -34,10 +41,6 @@ module Rango
34
41
  Rango.logger.debug("Calling method #{self.class.name}##{method} with arguments #{args.inspect}")
35
42
  self.response.body = self.method(method).call(*args)
36
43
  end
37
- self.run_filters(:after, method)
38
- return self.response.finish
39
- rescue HttpError => exception
40
- self.rescue_http_error(exception)
41
44
  end
42
45
 
43
46
  # for routers
@@ -6,6 +6,13 @@ module Rango
6
6
  controller.extend(ClassMethods)
7
7
  end
8
8
 
9
+ # for Rango::Controller
10
+ def process_action(method)
11
+ self.run_filters(:before, method)
12
+ super(method)
13
+ self.run_filters(:after, method)
14
+ end
15
+
9
16
  # @since 0.0.2
10
17
  def run_filters(name, method)
11
18
  # Rango.logger.debug(self.class.instance_variables)
@@ -24,7 +31,7 @@ module Rango
24
31
  end
25
32
  end
26
33
  end
27
-
34
+
28
35
  module ClassMethods
29
36
  def inherited(subclass)
30
37
  inherit_filters(subclass, :before)
@@ -66,5 +73,5 @@ module Rango
66
73
  attribute :before_display_filters, Array.new
67
74
  attribute :after_display_filters, Array.new
68
75
  end
69
- end
76
+ end
70
77
  end
data/lib/rango/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # NOTE: Do not edit this file manually, this
4
4
  # file is regenerated by task rake version:increase
5
5
  module Rango
6
- VERSION ||= "0.1.1.2.2"
6
+ VERSION ||= "0.1.1.2.3"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rango
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.2.2
4
+ version: 0.1.1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"