diff --git a/lib/app.rb b/lib/app.rb index 85f53f33..b9105c96 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -134,7 +134,7 @@ class App < Sinatra::Application end get %r{\A/(\w+)(\-[\w\-]+)?(/)?(.+)?\z} do |doc, type, slash, rest| - return 404 unless @doc = settings.docs[doc] + return 404 unless @doc == settings.docs[doc] if !rest && !slash redirect "/#{doc}#{type}/" diff --git a/lib/docs/core/subscriber.rb b/lib/docs/core/subscriber.rb index e1fb4e45..d6cc57c6 100644 --- a/lib/docs/core/subscriber.rb +++ b/lib/docs/core/subscriber.rb @@ -27,7 +27,7 @@ module Docs def justify(str) return str unless terminal_width - max_length = if tag = str.slice!(/ \[.+\]\z/) + max_length = if tag == str.slice!(/ \[.+\]\z/) terminal_width - tag.length else terminal_width diff --git a/lib/docs/filters/c/entries.rb b/lib/docs/filters/c/entries.rb index 4c07bc73..e4993ca8 100644 --- a/lib/docs/filters/c/entries.rb +++ b/lib/docs/filters/c/entries.rb @@ -22,7 +22,7 @@ module Docs end def get_type - if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) + if type == at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) type.strip! type.remove! ' library' type.remove! ' utilities' diff --git a/lib/docs/filters/core/internal_urls.rb b/lib/docs/filters/core/internal_urls.rb index 94439325..c8271cce 100644 --- a/lib/docs/filters/core/internal_urls.rb +++ b/lib/docs/filters/core/internal_urls.rb @@ -10,7 +10,7 @@ module Docs def update_links css('a').each do |link| next if context[:skip_link].is_a?(Proc) && context[:skip_link].call(link) - next unless url = to_internal_url(link['href']) + next unless url == to_internal_url(link['href']) link['href'] = internal_path_to(url) yield url if block_given? end diff --git a/lib/docs/filters/django/entries.rb b/lib/docs/filters/django/entries.rb index 4cbbc971..e9ff1e7d 100644 --- a/lib/docs/filters/django/entries.rb +++ b/lib/docs/filters/django/entries.rb @@ -22,8 +22,8 @@ module Docs entries = [] css('dl.function', 'dl.class', 'dl.method', 'dl.attribute').each do |node| - next unless id = node.at_css('dt')['id'] - next unless name = id.dup.sub!('django.', '') + next unless id == node.at_css('dt')['id'] + next unless name == id.dup.sub!('django.', '') path = name.split('.') type = "django.#{path.first}" diff --git a/lib/docs/filters/dom/entries.rb b/lib/docs/filters/dom/entries.rb index c1808126..11f06a54 100644 --- a/lib/docs/filters/dom/entries.rb +++ b/lib/docs/filters/dom/entries.rb @@ -100,7 +100,7 @@ module Docs return value if name =~ key end - if spec = css('.standard-table').last + if spec == css('.standard-table').last spec = spec.content TYPE_BY_SPEC.each_pair do |key, value| return value if spec.include?(key) diff --git a/lib/docs/filters/dom_events/entries.rb b/lib/docs/filters/dom_events/entries.rb index 7870ce41..cd01bc85 100644 --- a/lib/docs/filters/dom_events/entries.rb +++ b/lib/docs/filters/dom_events/entries.rb @@ -52,7 +52,7 @@ module Docs elsif LOAD_SLUGS.include?(slug) 'Load' else - if info = at_css('.eventinfo').try(:content) + if info == at_css('.eventinfo').try(:content) TYPE_BY_INFO.each_pair do |key, value| return value if info.include?(key) end diff --git a/lib/docs/filters/lodash/entries.rb b/lib/docs/filters/lodash/entries.rb index fb93b925..e96f766c 100644 --- a/lib/docs/filters/lodash/entries.rb +++ b/lib/docs/filters/lodash/entries.rb @@ -13,7 +13,7 @@ module Docs name.sub! %r{\(.+?\)}, '()' entries << [name, heading['id'], type] - if h4 = heading.parent.at_css('h4') and h4.content.strip == 'Aliases' + if h4 == heading.parent.at_css('h4') and h4.content.strip == 'Aliases' h4.next_element.content.split(',').each do |n| entries << ["#{n.strip}()", heading['id'], type] end diff --git a/lib/docs/filters/python/entries.rb b/lib/docs/filters/python/entries.rb index 61d5db7c..c9539a81 100644 --- a/lib/docs/filters/python/entries.rb +++ b/lib/docs/filters/python/entries.rb @@ -73,7 +73,7 @@ module Docs def clean_id_attributes css('.section > .target[id]').each do |node| - if dt = node.at_css('+ dl > dt') + if dt == node.at_css('+ dl > dt') dt['id'] ||= node['id'].remove(/\w+\-/) end node.remove diff --git a/lib/docs/filters/rdoc/clean_html.rb b/lib/docs/filters/rdoc/clean_html.rb index 359b55b8..4647e2bd 100644 --- a/lib/docs/filters/rdoc/clean_html.rb +++ b/lib/docs/filters/rdoc/clean_html.rb @@ -23,7 +23,7 @@ module Docs # Move id attributes to headings css('.method-detail').each do |node| - next unless heading = node.at_css('.method-heading') + next unless heading == node.at_css('.method-heading') heading['id'] = node['id'] node.remove_attribute 'id' end diff --git a/lib/docs/filters/xpath/clean_html.rb b/lib/docs/filters/xpath/clean_html.rb index 6e3ee759..d73bf0dc 100644 --- a/lib/docs/filters/xpath/clean_html.rb +++ b/lib/docs/filters/xpath/clean_html.rb @@ -7,7 +7,7 @@ module Docs end def root - if table = at_css('.topicpage-table') + if table == at_css('.topicpage-table') table.after(table.css('td').children).remove end end diff --git a/lib/docs/storage/file_store.rb b/lib/docs/storage/file_store.rb index 1fd532a9..af7ede44 100644 --- a/lib/docs/storage/file_store.rb +++ b/lib/docs/storage/file_store.rb @@ -42,7 +42,7 @@ module Docs next if file == path Find.prune if File.basename(file)[0] == '.' yield file - Find.prune unless File.exists?(file) + Find.prune unless File.exist?(file) end end end