Class: Axel::Router

Inherits:
Object
  • Object
show all
Defined in:
app/models/axel/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  self.path = path.to_s
  self.origin_klass = klass
  self.method_name = name.to_s
  self.options = options || {}
  extract_parameters!
end

Instance Attribute Details

#method_nameObject

Returns the value of attribute method_name.



13
14
15
# File 'app/models/axel/router.rb', line 13

def method_name
  @method_name
end

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'app/models/axel/router.rb', line 15

def options
  @options
end

#origin_klassObject

Returns the value of attribute origin_klass.



12
13
14
# File 'app/models/axel/router.rb', line 12

def origin_klass
  @origin_klass
end

#parametersObject

Returns the value of attribute parameters.



14
15
16
# File 'app/models/axel/router.rb', line 14

def parameters
  @parameters
end

#pathObject

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_routeObject



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
  route_options = extract_routed_args_options args
  run_route route_path, route_options
end