active_link_to 1.0.4 → 1.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: fd9a67de186dfcf5e517ed55994051723962da91
4
- data.tar.gz: 153e11c947d56e41e642e45a94295581a868c7f7
3
+ metadata.gz: d0d98b57bf4abf67586e2eb4121f6fdd0b435b2e
4
+ data.tar.gz: 7c59ffc37c74c76e97fa7d0d67918f2a91e6ecea
5
5
  SHA512:
6
- metadata.gz: 421d92f774bf0e904a8dede4c10910bc2fcd28ae9c7e39cc8f3142628557827224e3aa4bfbb9a67ba52527498e8cdf3e6525f814298cf26140d1ec6406ae3b7c
7
- data.tar.gz: 771b308ba2db04c506d3d7870c98be228388c09dfd8e79f0915721eeba9303f452014d4d4334f72d42f914ab49a7690e7b1ee1bdf0a2027386612ffc7fa45b9f
6
+ metadata.gz: bd29e30982524b635daba3fdfd64df45d4bc91c000d3c5946d00cde1732a2a791e548d74b6b204935aebad5c4d06150e42faa0eb40e4a19ee381dd8b30205fe4
7
+ data.tar.gz: 432188f6449e92a6fa822d8feecb516ee47afee975243fd66de33f57eb4245de934ed942ecf3d062a6680f6c0450d15c30a410bcd86173b343aec9575d53f364
data/README.md CHANGED
@@ -28,7 +28,6 @@ active_link_to 'Users', '/users', active: :inclusive
28
28
  Here's a list of available options that can be used as the `:active` value
29
29
 
30
30
  ```
31
- <<<<<<< HEAD
32
31
  * Boolean -> true | false
33
32
  * Symbol -> :exclusive | :inclusive | :exact
34
33
  * Regex -> /regex/
@@ -79,7 +78,7 @@ or action, or both? Or any number of those at the same time? Sure, why not:
79
78
  active_link_to 'User Edit', edit_user_path(@user), active: [['people', 'news'], ['show', 'edit']]
80
79
 
81
80
  # For matching specific controllers and actions:
82
- active_link_to 'User Edit', edit_user_path(@user), :active => [people: :show, news: :edit]
81
+ active_link_to 'User Edit', edit_user_path(@user), active: [people: :show, news: :edit]
83
82
 
84
83
  # for matching all actions under given controllers:
85
84
  active_link_to 'User Edit', edit_user_path(@user), active: [['people', 'news'], []]
@@ -97,7 +96,7 @@ active_link_to 'Users', users_path, active: true
97
96
  If we need to set link to be active based on `params`, we can do that as well:
98
97
 
99
98
  ```ruby
100
- active_link_to 'Admin users', users_path(role_eq: 'admin'), :active => { role_eq: 'admin' }
99
+ active_link_to 'Admin users', users_path(role_eq: 'admin'), active: { role_eq: 'admin' }
101
100
  ```
102
101
 
103
102
  ## More Options
@@ -10,15 +10,10 @@ module ActiveLinkTo
10
10
  # active_link_to('/users', class_active: 'enabled')
11
11
  # active_link_to(users_path, active: :exclusive, wrap_tag: :li)
12
12
  def active_link_to(*args, &block)
13
- if block_given?
14
- name = capture(&block)
15
- options = args[0] || {}
16
- html_options = args[1] || {}
17
- else
18
- name = args[0]
19
- options = args[1] || {}
20
- html_options = args[2] || {}
21
- end
13
+ name = block_given? ? capture(&block) : args.shift
14
+ options = args.shift || {}
15
+ html_options = args.shift || {}
16
+
22
17
  url = url_for(options)
23
18
 
24
19
  active_options = { }
@@ -118,4 +113,6 @@ module ActiveLinkTo
118
113
  end
119
114
  end
120
115
 
121
- ActionView::Base.send :include, ActiveLinkTo
116
+ ActiveSupport.on_load :action_view do
117
+ include ActiveLinkTo
118
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveLinkTo
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_link_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.5.1
80
+ rubygems_version: 2.6.11
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: ActionView helper to render currently active links