lib/loaf/view_extensions.rb in loaf-0.9.0 vs lib/loaf/view_extensions.rb in loaf-0.10.0
- old
+ new
@@ -43,18 +43,18 @@
#
# @param [Hash] options
#
# @api public
def breadcrumb_trail(options = {})
- return enum_for(:breadcrumb_trail) unless block_given?
+ return enum_for(:breadcrumb_trail, options) unless block_given?
valid?(options)
- options = Loaf.configuration.to_hash.merge(options)
+
_breadcrumbs.each do |crumb|
name = title_for(crumb.name)
path = url_for(_expand_url(crumb.url))
- current = current_crumb?(path, crumb.match)
+ current = current_crumb?(path, options.fetch(:match) { crumb.match })
yield(Loaf::Breadcrumb[name, path, current])
end
end
@@ -66,13 +66,13 @@
#
# @api public
def current_crumb?(path, pattern = :inclusive)
return false unless request.get? || request.head?
- origin_path = URI.parser.unescape(path).force_encoding(Encoding::BINARY)
+ origin_path = URI::DEFAULT_PARSER.unescape(path).force_encoding(Encoding::BINARY)
request_uri = request.fullpath
- request_uri = URI.parser.unescape(request_uri)
+ request_uri = URI::DEFAULT_PARSER.unescape(request_uri)
request_uri.force_encoding(Encoding::BINARY)
# strip away trailing slash
if origin_path.start_with?('/') && origin_path != '/'
origin_path.chomp!('/')