Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cerebroso/active_link_to
Browse files Browse the repository at this point in the history
…into cerebroso-master
  • Loading branch information
GBH committed Mar 17, 2017
2 parents d95e45e + db98b0f commit 3d9ce22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions active_link_to.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ Gem::Specification.new do |s|
s.homepage = "http://github.com/comfy/active_link_to"
s.summary = "ActionView helper to render currently active links"
s.description = "Helpful method when you need to add some logic that figures out if the link (or more often navigation item) is selected based on the current page or other arbitrary condition"

s.files = `git ls-files`.split("\n")
s.platform = Gem::Platform::RUBY
s.require_paths = ['lib']

s.add_dependency 'actionpack'
end
s.add_dependency 'addressable'
end
3 changes: 2 additions & 1 deletion lib/active_link_to.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require 'addressable/uri'
require 'active_link_to/active_link_to'
require 'active_link_to/version'
require 'active_link_to/version'
2 changes: 1 addition & 1 deletion lib/active_link_to/active_link_to.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def is_active_link?(url, condition = nil)
@is_active_link ||= {}
@is_active_link[[url, condition]] ||= begin
original_url = url
url = URI::parse(url).path
url = Addressable::URI::parse(url).path
case condition
when :inclusive, nil
!request.fullpath.match(/^#{Regexp.escape(url).chomp('/')}(\/.*|\?.*)?$/).blank?
Expand Down

0 comments on commit 3d9ce22

Please sign in to comment.