Class: Axel::Router
- Inherits:
-
Object
- Object
- Axel::Router
- Defined in:
- app/models/axel/router.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#origin_klass ⇒ Object
readonly
Returns the value of attribute origin_klass.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #define_route ⇒ Object
-
#initialize(klass, path, name, options = {}) ⇒ Router
constructor
A new instance of Router.
- #route(*args) ⇒ Object
Constructor Details
#initialize(klass, path, name, options = {}) ⇒ Router
Returns a new instance of Router.
17 18 19 20 21 22 23 |
# File 'app/models/axel/router.rb', line 17 def initialize(klass, path, name, = {}) self.path = path.to_s self.origin_klass = klass self.method_name = name.to_s self. = || {} extract_parameters! end |
Instance Attribute Details
#method_name ⇒ Object
Returns the value of attribute method_name.
13 14 15 |
# File 'app/models/axel/router.rb', line 13 def method_name @method_name end |
#options ⇒ Object
Returns the value of attribute options.
15 16 17 |
# File 'app/models/axel/router.rb', line 15 def @options end |
#origin_klass ⇒ Object
Returns the value of attribute origin_klass.
12 13 14 |
# File 'app/models/axel/router.rb', line 12 def origin_klass @origin_klass end |
#parameters ⇒ Object
Returns the value of attribute parameters.
14 15 16 |
# File 'app/models/axel/router.rb', line 14 def parameters @parameters end |
#path ⇒ Object
Returns the value of attribute path.
11 12 13 |
# File 'app/models/axel/router.rb', line 11 def path @path end |
Instance Method Details
#define_route ⇒ Object
25 26 27 28 |
# File 'app/models/axel/router.rb', line 25 def define_route setup_klass_method self end |
#route(*args) ⇒ Object
30 31 32 33 34 |
# File 'app/models/axel/router.rb', line 30 def route(*args) route_path = build_path_with_args *args = args run_route route_path, end |