active_link_to 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
  SHA256:
3
- metadata.gz: 23739b476611e406b4da34c0597867fa72eaf5e218d736732a44b2acfc9bf425
4
- data.tar.gz: 3edfd60e459ba7b00ea7943cada4db37ac4c94ba23c91768098d62770ed19a2a
3
+ metadata.gz: 2e47fd89e74a82acaa58cec5acad77d15f1032cb9fb864fd69f2309d035190c5
4
+ data.tar.gz: 84de88127ce490bb53e0ad7a24d789d74bdc7eb3af7d1685cb0fb3ff1c191e19
5
5
  SHA512:
6
- metadata.gz: 90a5df4d63147bc0e26757709e00ac5aeb8a51692709a9666948dcfb773bcdf4874f8711a0df9f9ac05760101ad2a4bed34d30c26ff239c99496f13100a8262c
7
- data.tar.gz: 19d95a895f0bd464afcd0ca91693c99903cf9db248d79b58043e1e5ac8beac79d6a7a4965d38b3800b8ca10902f3f21ab37d8744772539c37863509263f07a9f
6
+ metadata.gz: 369a955ee89c2b5df84c57bde6d43f76fe99ef62ab22544b4aa9e09355c0f90afc4461a00aa89d0f3ad45b7aec2020a3833976144dd40ad23cad04b95570a91f
7
+ data.tar.gz: 56a6ed560b77abd73140262c8818051264dd84ab6fe47d9da2d2ae7ed3392d4ef2383e8ad307c93b52aaf4d68b93322e85405941e040ef53a9c05dceec533090
data/README.md CHANGED
@@ -4,6 +4,7 @@ Creates a link tag of the given name using a URL created by the set of options.
4
4
 
5
5
  [![Gem Version](https://img.shields.io/gem/v/active_link_to.svg?style=flat)](http://rubygems.org/gems/active_link_to)
6
6
  [![Gem Downloads](https://img.shields.io/gem/dt/active_link_to.svg?style=flat)](http://rubygems.org/gems/active_link_to)
7
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/comfy/active_link_to/build.yml?branch=master)
7
8
 
8
9
  ## Install
9
10
 
@@ -132,7 +132,8 @@ module ActiveLinkTo
132
132
  end
133
133
 
134
134
  pairs.any? do |controllers, actions|
135
- [*controllers].map(&:to_s).include?(params[:controller]) && [*actions].map(&:to_s).include?(params[:action])
135
+ (controllers.blank? || [*controllers].map(&:to_s).include?(params[:controller])) &&
136
+ (actions.blank? || [*actions].map(&:to_s).include?(params[:action]))
136
137
  end
137
138
 
138
139
  when TrueClass
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveLinkTo
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
@@ -106,6 +106,26 @@ RSpec.describe ActiveLinkTo do
106
106
  expect(is_active_link?("/", %w[foos other])).to be(false)
107
107
  end
108
108
 
109
+ it "matches on any action for a given controller" do
110
+ # currently active controller/action pair
111
+ params[:controller] = "foos"
112
+ params[:action] = "bar"
113
+
114
+ expect(is_active_link?("/", [%w[foos bars], []])).to be(true)
115
+ expect(is_active_link?("/", ["foos", []])).to be(true)
116
+ expect(is_active_link?("/", ["bars", []])).to be(false)
117
+ end
118
+
119
+ it "matches on any controller for a given action" do
120
+ # currently active controller/action pair
121
+ params[:controller] = "foos"
122
+ params[:action] = "bar"
123
+
124
+ expect(is_active_link?("/", [[], %w[foo bar]])).to be(true)
125
+ expect(is_active_link?("/", [[], "bar"])).to be(true)
126
+ expect(is_active_link?("/", [[], "foo"])).to be(false)
127
+ end
128
+
109
129
  it "works when flag is defined as a hash" do
110
130
  # currently active controller/action pair
111
131
  params[:controller] = "foos"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_link_to
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
  - Oleg Khabarov
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 4.0.9
83
+ rubygems_version: 4.0.23
84
84
  specification_version: 4
85
85
  summary: ActionView helper to render currently active links
86
86
  test_files: []