coffee_routes 1.1.0 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa05708db5df8866ba3d2afae4525f55e3720b3e
4
- data.tar.gz: 7c494d355047a7ec277f9b210cbd8384aca8d64f
3
+ metadata.gz: 40262f6745bf348669431b6771ba298cee984d4d
4
+ data.tar.gz: 2cc66fef2c8668b68c1e24016b998bf6390e3e1a
5
5
  SHA512:
6
- metadata.gz: de54c9739b7fa86e6a661bbe1dd0bde95e02d2b84c1d07911adeedcac4d210622a1fbb9d736ed1d18460a600a496047b59d098953816f3d70ae0543512ca4902
7
- data.tar.gz: e447455fa90f3b44294b12c0494577ec6c0c25e75fb21c4e5d16c470ef553234c1505643365a26c8a7e6d31ec4bbe6a54be2521024ebcd8a64019e5ff2a64c71
6
+ metadata.gz: bec9bca43fba06a7f6f470a7d6088911f40c7b35f55cbc985a75b6756e1b97e8c01710e9633e32e1b9d3b108437e1984dece96ce39696f164c7923cb678bde0e
7
+ data.tar.gz: 6cbe9913dd06c2300d2f4b2d09ad5def7ed5e83c3cec955d9f6b9152f3939dd1436518c541adc0542cb0881f72f47434aa5dd5256b989f529aa61e6025acf184
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CoffeeRoutes
2
2
 
3
- Access your Rails named routes from coffeescript.
3
+ Access your Rails named routes from coffeescript. Read about the making of [here](http://darkphnx.com/2014/10/23/coffeeroutes-named-routes-in-coffeescript/).
4
4
 
5
5
  ## Installation
6
6
 
@@ -53,4 +53,4 @@ You can also get the HTTP verb that should be used with the named route.
53
53
  ```coffee
54
54
  CoffeeRoutes.method('project_item')
55
55
  => "GET"
56
- ```
56
+ ```
data/lib/coffee_routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "coffee_routes/version"
2
- require 'action_dispatch/routing/json_formatter'
2
+ require 'coffee_routes/json_formatter'
3
3
 
4
4
  module CoffeeRoutes
5
5
  module Rails
@@ -10,6 +10,6 @@ module CoffeeRoutes
10
10
  def self.routes(controller=nil)
11
11
  all_routes = ::Rails.application.routes.routes
12
12
  inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
13
- inspector.format(ActionDispatch::Routing::JSONFormatter.new, controller)
13
+ inspector.format(CoffeeRoutes::JSONFormatter.new, controller)
14
14
  end
15
15
  end
@@ -0,0 +1,42 @@
1
+ # ActionDispatch::Routing::RoutesInspector says people shouldn't use
2
+ # it, but lets pretend we didn't see it.
3
+
4
+
5
+ module CoffeeRoutes
6
+ class JSONFormatter
7
+
8
+ def initialize
9
+ @buffer = {}
10
+ end
11
+
12
+ # Serialize the buffer has as json
13
+ def result
14
+ ActiveSupport::JSON.encode(@buffer)
15
+ end
16
+
17
+ # No need for a title, we only want the data
18
+ def section_title(title)
19
+ end
20
+
21
+ def section(routes)
22
+ @buffer.merge! draw_section(routes)
23
+ end
24
+
25
+ # No need for a header, we only want data
26
+ def header(routes)
27
+ end
28
+
29
+ # No routes will be represented by an empty object
30
+ def no_routes
31
+ end
32
+
33
+ private
34
+
35
+ def draw_section(routes)
36
+ routes.each_with_object({}) do |r, hash|
37
+ hash[r[:name]] = {:path => r[:path], :verb => r[:verb]}
38
+ end
39
+ end
40
+
41
+ end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module CoffeeRoutes
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -30,5 +30,4 @@ window.CoffeeRoutes =
30
30
  for route_name, data of CoffeeRoutes.routes
31
31
  do (route_name, data) ->
32
32
  window["#{route_name}_path"] = (params)->
33
- route = route_name += ""
34
- CoffeeRoutes.path(route, params)
33
+ CoffeeRoutes.path(route_name, params)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffee_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Wentworth
@@ -64,8 +64,8 @@ files:
64
64
  - README.md
65
65
  - Rakefile
66
66
  - coffee_routes.gemspec
67
- - lib/action_dispatch/routing/json_formatter.rb
68
67
  - lib/coffee_routes.rb
68
+ - lib/coffee_routes/json_formatter.rb
69
69
  - lib/coffee_routes/version.rb
70
70
  - vendor/assets/javascripts/coffee_routes.coffee.erb
71
71
  homepage: http://darkphnx.com
@@ -1,44 +0,0 @@
1
- # ActionDispatch::Routing::RoutesInspector says people shouldn't use
2
- # it, but lets pretend we didn't see it.
3
-
4
-
5
- module ActionDispatch
6
- module Routing
7
- class JSONFormatter
8
-
9
- def initialize
10
- @buffer = {}
11
- end
12
-
13
- # Serialize the buffer has as json
14
- def result
15
- ActiveSupport::JSON.encode(@buffer)
16
- end
17
-
18
- # No need for a title, we only want the data
19
- def section_title(title)
20
- end
21
-
22
- def section(routes)
23
- @buffer.merge! draw_section(routes)
24
- end
25
-
26
- # No need for a header, we only want data
27
- def header(routes)
28
- end
29
-
30
- # No routes will be represented by an empty object
31
- def no_routes
32
- end
33
-
34
- private
35
-
36
- def draw_section(routes)
37
- routes.each_with_object({}) do |r, hash|
38
- hash[r[:name]] = {:path => r[:path], :verb => r[:verb]}
39
- end
40
- end
41
-
42
- end
43
- end
44
- end