katgut 0.0.4 → 0.0.5

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: 6e8469080830bb56b0884964cbf8b07ab6439fea
4
- data.tar.gz: 0e77c797ec4131e6f658e93948adc3b4e2552afd
3
+ metadata.gz: f8697ef6393b674720a4de45f8afdde983cb50ae
4
+ data.tar.gz: 732d22aee2fbf4c09283b424fe3ae51cdd079536
5
5
  SHA512:
6
- metadata.gz: 945fe64304cdeeea0cf2b922ebadc932c589f7a4efe587254b6dc9985549abc0e95e581e3a3a937a9c014f91b0c23d55f8d8483a06958602962f437a38027b56
7
- data.tar.gz: f78bf1a6b05833574776909cf5b600e7e53ed48b21793a2053576c08b316f630fa1a324b8efc36349c4afe27a1076d8306e3c527a1f9960bde81f682f9d1d15f
6
+ metadata.gz: c192da2e1ac888d7bf7cb84de20fb217978c26c4f40f02db1ee0532a9ec94a9cb06660211d8a88c59cb83dfa9377b8b96227ecaf711f1e78f1442696d8423e83
7
+ data.tar.gz: 9f676b81ac6c783e09ac3b0f736ff2a63219a76bf2d1043eed566a85ada1b1bc9537fa3eda17a2d4e7889feb6947e33754db2bedeb743c087aa4f550580ee934
data/README.md CHANGED
@@ -76,6 +76,35 @@ Katgut::Rule.new(source: "go-to-google", destination: "https://www.google.co.jp/
76
76
  # GET /katgut/go-to-google => GET https://www.google.co.jp/
77
77
  ```
78
78
 
79
+ ## URL helpers
80
+ Katgut defines url helpers to generate redirection urls.
81
+
82
+ Suppose the engine is mounted to your app in this way:
83
+
84
+ ```ruby
85
+ # config/routes.rb
86
+ Rails.application.routes.draw do
87
+ mount Katgut::Engine => "/katgut"
88
+ end
89
+ ```
90
+
91
+ Then you can access predefined url helpers like this:
92
+
93
+ ```ruby
94
+ # app/controllers/xxxx_controller.rb
95
+
96
+ katgut.rule_path("source_string") # => "/katgut/source_string"
97
+ ```
98
+
99
+ You can see all the predefined helpers in `Routes for Katgut::Engine` section in the list that `rake routes` generates.
100
+
101
+ ```bash
102
+ $ rake routes | grep --ignore-case katgut
103
+
104
+ Routes for Katgut::Engine:
105
+ rule GET /:id(.:format) katgut/rules#show
106
+ ```
107
+
79
108
  ## Customization
80
109
  You can customize the behavour of the gem through the initializer script.
81
110
 
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Katgut::Engine.routes.draw do
2
- get '/:id', to: 'rules#show'
2
+ get '/:id', to: 'rules#show', as: :rule
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Katgut
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katgut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - HAMADA Kazuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-08 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails