rails_nav 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/rails_nav.rb +26 -24
  2. data/rails_nav.gemspec +1 -1
  3. metadata +5 -5
data/lib/rails_nav.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  ##
5
5
  #
6
6
  def Nav.version()
7
- '1.0.0'
7
+ '1.0.1'
8
8
  end
9
9
 
10
10
  def Nav.dependencies
@@ -65,34 +65,36 @@
65
65
  ##
66
66
  #
67
67
  def compute_active!
68
- weights = []
69
-
70
- each_with_index do |link, index|
71
- link.controller = @controller
72
- active = link.compute_active!
73
-
74
- weights[index] =
75
- case active
76
- when nil, false
77
- -1
78
- when true
79
- 0
80
- else
81
- Integer(active)
82
- end
83
- end
68
+ unless empty?
69
+ weights = []
70
+
71
+ each_with_index do |link, index|
72
+ link.controller = @controller
73
+ active = link.compute_active!
74
+
75
+ weights[index] =
76
+ case active
77
+ when nil, false
78
+ -1
79
+ when true
80
+ 0
81
+ else
82
+ Integer(active)
83
+ end
84
+ end
84
85
 
85
- each_with_index do |link, index|
86
- link.active = false
87
- end
86
+ each_with_index do |link, index|
87
+ link.active = false
88
+ end
89
+
90
+ active_link = self[weights.index(weights.max)]
88
91
 
89
- active_link = self[weights.index(weights.max)]
92
+ active_link.active = true
90
93
 
91
- active_link.active = true
94
+ @already_computed_active = true
95
+ end
92
96
 
93
97
  self
94
- ensure
95
- @already_computed_active = true
96
98
  end
97
99
 
98
100
  def compute_active
data/rails_nav.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_nav"
6
- spec.version = "1.0.0"
6
+ spec.version = "1.0.1"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_nav"
9
9
  spec.description = "description: rails_nav kicks the ass"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_nav
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails_current
16
- requirement: &70363954688740 !ruby/object:Gem::Requirement
16
+ requirement: &70198040784780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.6'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70363954688740
24
+ version_requirements: *70198040784780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails_helper
27
- requirement: &70363954688240 !ruby/object:Gem::Requirement
27
+ requirement: &70198040604960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '1.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70363954688240
35
+ version_requirements: *70198040604960
36
36
  description: ! 'description: rails_nav kicks the ass'
37
37
  email: ara.t.howard@gmail.com
38
38
  executables: []