rails_templated_urls 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5589bbdb5208706c2d1f25d1ae1f4da922abc40e
4
- data.tar.gz: e9d74cdc8550befeb68635c3c13cc25ca6acbe55
3
+ metadata.gz: 760d59f73f0f27a9f981644d3720e604203b0f3a
4
+ data.tar.gz: 5bd78dd7c05b22ac1e4f166530c0c96a9465037c
5
5
  SHA512:
6
- metadata.gz: fde8250e5b2dc486d4bf3d05c90fd8a3a06bd6eaf0c52107b623319ae6f9e4d493aff58b5215b1a344124c653bebc012274fbc4b52117bc4539f54e544a6e20c
7
- data.tar.gz: 4aa634f68b097e8dce221310cc0fdba2adfdfe6ad0f34d561f6708eaec090d9ccd442bea888484063cfedbdff03e491b1d138edcf4b3e5b02c5acb8a5797cf9a
6
+ metadata.gz: 840b7d47ed1ab8556b3a5ed7232bdad62ab376b071402fa4f55afd7b861ce37e56897070799ee38fbffe61dbfcbd1073a9167a23226da27394a158d5da6f25f2
7
+ data.tar.gz: 579128c5fcc116976aeacfc71942338ca6d5ec1e48c9df087daab9b4b3f6f9581d53863ffae0a411902e91f428e7edb3ce399d8d204ef9881fac49834ccb3471
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # RailsTemplatedUrls
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_templated_urls`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This gem provides some helpers to build [templated URLS][1] based on the named
4
+ routes of your Rails application.
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,18 +21,46 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ Assuming you have the following route on your `routes.rb` file:
25
+
26
+ ```ruby
27
+ Rails.application.routes.draw do
28
+ resources :books
29
+ end
30
+ ```
31
+
32
+ You can use the following helpers on your views:
33
+
34
+ ```ruby
35
+ templated_path :books # => "/books"
36
+ templated_path :book # => "/books/{id}"
37
+ templated_path :edit_book # => "/books/{id}/edit"
38
+ templated_path :books, :foo, :bar # => "/books{?foo,bar}"
39
+ ```
40
+
41
+ If you want the full URL, you can use another helper:
42
+
43
+ ```ruby
44
+ templated_url :book # => "http://localhost:3000/books/{id}"
45
+ ```
26
46
 
27
47
  ## Development
28
48
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
49
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
50
+ `bin/console` for an interactive prompt that will allow you to experiment.
30
51
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To
53
+ release a new version, update the version number in `version.rb`, and then run
54
+ `bundle exec rake release` to create a git tag for the version, push git commits
55
+ and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
56
 
33
57
  ## Contributing
34
58
 
35
- 1. Fork it ( https://github.com/[my-github-username]/rails_templated_urls/fork )
59
+ 1. Fork it ( https://github.com/lenon/rails_templated_urls/fork )
36
60
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
61
  3. Commit your changes (`git commit -am 'Add some feature'`)
38
62
  4. Push to the branch (`git push origin my-new-feature`)
39
63
  5. Create a new Pull Request
64
+
65
+ [1]: http://tools.ietf.org/html/rfc6570
66
+ [2]: http://devdocs.io/rails/abstractcontroller/helpers/classmethods#method-i-helper
@@ -1,4 +1,9 @@
1
+ require 'rails'
1
2
  require 'rails_templated_urls/version'
2
3
  require 'rails_templated_urls/errors'
3
4
  require 'rails_templated_urls/builder'
4
5
  require 'rails_templated_urls/view_helpers'
6
+
7
+ ActiveSupport.on_load :action_view do
8
+ include RailsTemplatedUrls::ViewHelpers
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsTemplatedUrls
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_templated_urls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lenon Marcel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-17 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails