divert 0.0.1 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/divert/version.rb +1 -1
  2. data/lib/divert.rb +12 -6
  3. metadata +2 -2
@@ -1,3 +1,3 @@
1
1
  module Divert
2
- VERSION = "0.0.1"
2
+ VERSION = "0.2"
3
3
  end
data/lib/divert.rb CHANGED
@@ -1,13 +1,17 @@
1
1
  require "divert/engine"
2
2
 
3
3
  module Divert
4
- def divert
5
- if template_exists?(params[:path], [controller_name])
6
- render "#{controller_name}/#{params[:path]}" and return
4
+ def action_missing path
5
+ puts "DIVERTIO!"
6
+ path ||= params[:path]
7
+ if action_methods.include? path
8
+ puts "SENDING METHOD: #{path}"
9
+ send path and return
7
10
  end
8
11
 
9
- if action_methods.include? params[:path]
10
- send params[:path] and return
12
+ if template_exists?(path, [controller_name])
13
+ puts "RENDERING METHOD: #{path}"
14
+ render "#{controller_name}/#{path}" and return
11
15
  end
12
16
 
13
17
  if (redirect = Redirect.hit request.fullpath)
@@ -16,12 +20,14 @@ module Divert
16
20
  unless template_exists? 'divert', [controller_name]
17
21
  render text:"Missing divert view: #{controller_name}/divert.html.erb" and return
18
22
  end
23
+ render "#{controller_name}/divert" and return
19
24
  end
20
25
  end
21
26
  end
22
27
 
23
28
  class ActionDispatch::Routing::Mapper
24
29
  def divert_with controller
25
- match '*path' => "#{controller}#divert", :format => false
30
+ match ":action" => "static"
31
+ match '*path' => "#{controller}#action_missing", :format => false
26
32
  end
27
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: divert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-06 00:00:00.000000000 Z
12
+ date: 2013-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails