selected 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/selected.rb +7 -3
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f473d826c67a5cee05b4c9e1e01e23e1a6ee71d1
4
- data.tar.gz: 2b7b6fedb8a2593b47dfc3048067b949646928f0
3
+ metadata.gz: 6b3619c83079d548476017753c4246bf051fd930
4
+ data.tar.gz: cd451697cb9a5eb3397c59e5a65e14affc3aa12a
5
5
  SHA512:
6
- metadata.gz: f282a346d8c35b06d57dbda1c9730972f71d8d79da3db216f4de53ca8dce60ca10ceba2c11ea8f23ddb9998508aa93bbba3da8ae2e4bbf872960cca78992cf48
7
- data.tar.gz: a461bb054bf9019a661ee4910013264c5f1ef67dcd78869b270a1d1aab3a795c2feb25142867c3700509fcebc3b94b002650f7bdb892482f6fb051ec9ab451c5
6
+ metadata.gz: 35792f255f87b46bb189c65a6d49b79a79c0e99700c105afab08cf23ef02da482e72ee034a87da6f5b2542bee890010fef50ada5543a67e5dd8a8d51a9d06821
7
+ data.tar.gz: 0e84ab82d54e36ba10098a34f282316a9b73c7d93b2990e97bd920d3c9d17fa034708d0c5b67162466ec0849c98f2de4ad958ab304fcccbd06cd2410168ed557
@@ -1,7 +1,7 @@
1
1
  module Selected
2
2
  def selected?(controller_name, action_name="", id="")
3
3
  if controller_matches(controller_name) && action_matches(action_name) && params[:id] == id
4
- "selected"
4
+ SELECTED_CLASS_NAME || "active"
5
5
  end
6
6
  unless action_name.present?
7
7
  action_name = params[:action]
@@ -11,14 +11,18 @@ module Selected
11
11
  end
12
12
 
13
13
  if controller_matches(controller_name) && action_matches(action_name) && params[:id] == id
14
- "selected"
14
+ SELECTED_CLASS_NAME || "active"
15
15
  end
16
16
  end
17
17
 
18
18
  private
19
19
 
20
20
  def controller_matches(controller_name)
21
- params[:controller] == controller_name.to_s
21
+ if controller_name.is_a?(Regexp)
22
+ controller_name =~ params[:controller]
23
+ else
24
+ controller_name.to_s == params[:controller]
25
+ end
22
26
  end
23
27
 
24
28
  def action_matches(action_name)
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selected
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaut Assus
8
- - Melissa Grach
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
11
  date: 2014-10-15 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: A simple gem to know if a link should get the selected class
13
+ description: A simple gem to know if a link should get the class 'active'
15
14
  email: thibaut@milesrock.com
16
15
  executables: []
17
16
  extensions: []
@@ -38,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
37
  version: '0'
39
38
  requirements: []
40
39
  rubyforge_project:
41
- rubygems_version: 2.2.2
40
+ rubygems_version: 2.4.5
42
41
  signing_key:
43
42
  specification_version: 4
44
43
  summary: Selected