diff --git a/lib/docs/core/filter.rb b/lib/docs/core/filter.rb
index 578484e7..de176544 100644
--- a/lib/docs/core/filter.rb
+++ b/lib/docs/core/filter.rb
@@ -41,7 +41,7 @@ module Docs
end
def slug
- @slug ||= subpath.sub(/\A\//, '').sub(/\.html\z/, '')
+ @slug ||= subpath.sub(/\A\//, '').remove(/\.html\z/)
end
def root_page?
diff --git a/lib/docs/core/scrapers/file_scraper.rb b/lib/docs/core/scrapers/file_scraper.rb
index 94d82de4..8c087213 100644
--- a/lib/docs/core/scrapers/file_scraper.rb
+++ b/lib/docs/core/scrapers/file_scraper.rb
@@ -34,7 +34,7 @@ module Docs
end
def file_path_for(url)
- File.join self.class.dir, url.sub(base_url.to_s, '')
+ File.join self.class.dir, url.remove(base_url.to_s)
end
def read_file(path)
diff --git a/lib/docs/core/subscriber.rb b/lib/docs/core/subscriber.rb
index 5c21acb5..e1fb4e45 100644
--- a/lib/docs/core/subscriber.rb
+++ b/lib/docs/core/subscriber.rb
@@ -17,11 +17,11 @@ module Docs
end
def format_url(url)
- url.to_s.sub %r{\Ahttps?://}, ''
+ url.to_s.remove %r{\Ahttps?://}
end
def format_path(path)
- path.to_s.sub File.join(File.expand_path('.'), ''), ''
+ path.to_s.remove File.join(File.expand_path('.'), '')
end
def justify(str)
diff --git a/lib/docs/filters/angular/entries.rb b/lib/docs/filters/angular/entries.rb
index f8aec38c..3f61c0f0 100644
--- a/lib/docs/filters/angular/entries.rb
+++ b/lib/docs/filters/angular/entries.rb
@@ -3,7 +3,7 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
name = slug.split(':').last
- name.sub! %r{\Ang\.}, ''
+ name.remove! %r{\Ang\.}
name << " (#{subtype})" if subtype == 'directive' || subtype == 'filter'
name
end
diff --git a/lib/docs/filters/backbone/entries.rb b/lib/docs/filters/backbone/entries.rb
index 694f4c67..d637a46c 100644
--- a/lib/docs/filters/backbone/entries.rb
+++ b/lib/docs/filters/backbone/entries.rb
@@ -8,7 +8,7 @@ module Docs
css('[id]').each do |node|
# Module
if node.name == 'h2'
- type = node.content.sub 'Backbone.', ''
+ type = node.content.remove 'Backbone.'
if type.capitalize! # sync, history
entries << [node.content, node['id'], type]
end
diff --git a/lib/docs/filters/c/clean_html.rb b/lib/docs/filters/c/clean_html.rb
index 70c89f77..1a637b73 100644
--- a/lib/docs/filters/c/clean_html.rb
+++ b/lib/docs/filters/c/clean_html.rb
@@ -35,7 +35,7 @@ module Docs
end
css('area[href]').each do |node|
- node['href'] = node['href'].sub('.html', '')
+ node['href'] = node['href'].remove('.html')
end
doc
diff --git a/lib/docs/filters/c/entries.rb b/lib/docs/filters/c/entries.rb
index 9e8dc854..4c07bc73 100644
--- a/lib/docs/filters/c/entries.rb
+++ b/lib/docs/filters/c/entries.rb
@@ -15,8 +15,8 @@ module Docs
def get_name
name = at_css('#firstHeading').content.strip
- name.sub! 'C keywords: ', ''
- name.sub! %r{\s\(.+\)}, ''
+ name.remove! 'C keywords: '
+ name.remove! %r{\s\(.+\)}
name = name.split(',').first
REPLACE_NAMES[name] || name
end
@@ -24,8 +24,8 @@ module Docs
def get_type
if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
type.strip!
- type.sub! ' library', ''
- type.sub! ' utilities', ''
+ type.remove! ' library'
+ type.remove! ' utilities'
type
end
end
diff --git a/lib/docs/filters/core/clean_text.rb b/lib/docs/filters/core/clean_text.rb
index e525c8a5..851246bc 100644
--- a/lib/docs/filters/core/clean_text.rb
+++ b/lib/docs/filters/core/clean_text.rb
@@ -4,7 +4,7 @@ module Docs
def call
html.strip!
- while html.gsub!(EMPTY_NODES_RGX, ''); end
+ while html.remove!(EMPTY_NODES_RGX); end
html
end
end
diff --git a/lib/docs/filters/core/normalize_paths.rb b/lib/docs/filters/core/normalize_paths.rb
index f920ffd0..8880643d 100644
--- a/lib/docs/filters/core/normalize_paths.rb
+++ b/lib/docs/filters/core/normalize_paths.rb
@@ -21,7 +21,7 @@ module Docs
end
def normalized_subpath
- normalize_path subpath.sub(/\A\//, '')
+ normalize_path subpath.remove(/\A\//)
end
def normalize_href(href)
diff --git a/lib/docs/filters/cpp/entries.rb b/lib/docs/filters/cpp/entries.rb
index 95e4fb58..fcdd64a0 100644
--- a/lib/docs/filters/cpp/entries.rb
+++ b/lib/docs/filters/cpp/entries.rb
@@ -10,10 +10,10 @@ module Docs
def get_name
name = at_css('#firstHeading').content.strip
- name.sub! 'C++ concepts: ', ''
- name.sub! 'C++ keywords: ', ''
- name.sub! 'C++ ', ''
- name.sub! %r{\s\(.+\)}, ''
+ name.remove! 'C++ concepts: '
+ name.remove! 'C++ keywords: '
+ name.remove! 'C++ '
+ name.remove! %r{\s\(.+\)}
name.sub! %r{\AStandard library header <(.+)>\z}, '\1'
name = name.split(',').first
REPLACE_NAMES[name] || name
@@ -24,9 +24,9 @@ module Docs
'Keywords'
elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content)
type.strip!
- type.sub! ' library', ''
- type.sub! ' utilities', ''
- type.sub! 'C++ ', ''
+ type.remove! ' library'
+ type.remove! ' utilities'
+ type.remove! 'C++ '
type.capitalize!
type
end
@@ -34,7 +34,7 @@ module Docs
def additional_entries
return [] unless include_default_entry?
- names = at_css('#firstHeading').content.gsub(%r{\(.+?\)}, '').split(',')[1..-1]
+ names = at_css('#firstHeading').content.remove(%r{\(.+?\)}).split(',')[1..-1]
names.each(&:strip!).reject! do |name|
name.size <= 2 || name == '...' || name =~ /\A[<>]/ || name.start_with?('operator')
end
diff --git a/lib/docs/filters/css/entries.rb b/lib/docs/filters/css/entries.rb
index 0a83826e..12856871 100644
--- a/lib/docs/filters/css/entries.rb
+++ b/lib/docs/filters/css/entries.rb
@@ -60,7 +60,7 @@ module Docs
def get_name
case type
- when 'Data Types' then "<#{super.gsub(' value', '')}>"
+ when 'Data Types' then "<#{super.remove ' value'}>"
when 'Functions' then "#{super}()"
else super
end
diff --git a/lib/docs/filters/d3/clean_html.rb b/lib/docs/filters/d3/clean_html.rb
index 7e959bcf..783cca7b 100644
--- a/lib/docs/filters/d3/clean_html.rb
+++ b/lib/docs/filters/d3/clean_html.rb
@@ -4,7 +4,7 @@ module Docs
def call
# Remove links inside
and add "id" attributes
css('h2 > a').each do |node|
- node.parent['id'] = node['name'].sub('wiki-', '') if node['name']
+ node.parent['id'] = node['name'].remove('wiki-') if node['name']
node.before(node.children).remove
end
@@ -26,7 +26,7 @@ module Docs
next unless node['name'] || node.content == '#'
parent = node.parent
parent.name = 'h6'
- parent['id'] = (node['name'] || node['href'].sub(/\A.+#/, '')).sub('wiki-', '')
+ parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('wiki-')
parent.css('a[name]').remove
node.remove
end
diff --git a/lib/docs/filters/d3/entries.rb b/lib/docs/filters/d3/entries.rb
index 7b18891b..34fc3323 100644
--- a/lib/docs/filters/d3/entries.rb
+++ b/lib/docs/filters/d3/entries.rb
@@ -12,7 +12,7 @@ module Docs
def additional_entries
css('h6[id]').inject [] do |entries, node|
name = node.content
- name.sub! %r{\(.*\z}, ''
+ name.remove! %r{\(.*\z}
entries << [name, node['id']] unless name == entries.last.try(:first)
entries
end
diff --git a/lib/docs/filters/git/clean_html.rb b/lib/docs/filters/git/clean_html.rb
index 5aafd0b4..7da84879 100644
--- a/lib/docs/filters/git/clean_html.rb
+++ b/lib/docs/filters/git/clean_html.rb
@@ -18,7 +18,7 @@ module Docs
end
css('> h1').each do |node|
- node.content = node.content.sub(/\(\d\) Manual Page/, '')
+ node.content = node.content.remove(/\(\d\) Manual Page/)
end
unless at_css('> h2')
diff --git a/lib/docs/filters/go/clean_html.rb b/lib/docs/filters/go/clean_html.rb
index 90aa288e..78e798a3 100644
--- a/lib/docs/filters/go/clean_html.rb
+++ b/lib/docs/filters/go/clean_html.rb
@@ -18,7 +18,7 @@ module Docs
# Remove triangle character
css('h2', '.exampleHeading').each do |node|
- node.content = node.content.sub("\u25BE", '')
+ node.content = node.content.remove("\u25BE")
node.name = 'h2'
end
diff --git a/lib/docs/filters/go/entries.rb b/lib/docs/filters/go/entries.rb
index 18e327f2..e8339679 100644
--- a/lib/docs/filters/go/entries.rb
+++ b/lib/docs/filters/go/entries.rb
@@ -3,7 +3,7 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content
- name.sub! 'Package ', ''
+ name.remove! 'Package '
name
end
diff --git a/lib/docs/filters/javascript/entries.rb b/lib/docs/filters/javascript/entries.rb
index 28020af1..fab954cc 100644
--- a/lib/docs/filters/javascript/entries.rb
+++ b/lib/docs/filters/javascript/entries.rb
@@ -19,9 +19,9 @@ module Docs
name
else
name = super
- name.sub! 'Functions and function scope.', ''
- name.sub! 'Operators.', ''
- name.sub! 'Statements.', ''
+ name.remove! 'Functions and function scope.'
+ name.remove! 'Operators.'
+ name.remove! 'Statements.'
name
end
end
@@ -34,7 +34,7 @@ module Docs
elsif slug.start_with? 'Functions_and_function_scope'
'Function'
elsif slug.start_with? 'Global_Objects'
- object, method = *slug.sub('Global_Objects/', '').split('/')
+ object, method = *slug.remove('Global_Objects/').split('/')
if object.end_with? 'Error'
'Errors'
elsif INTL_OBJECTS.include?(object)
diff --git a/lib/docs/filters/jquery_mobile/entries.rb b/lib/docs/filters/jquery_mobile/entries.rb
index 9815af31..eb52c097 100644
--- a/lib/docs/filters/jquery_mobile/entries.rb
+++ b/lib/docs/filters/jquery_mobile/entries.rb
@@ -6,7 +6,7 @@ module Docs
def get_name
name = at_css('h1').content.strip
- name.sub! ' Widget', ''
+ name.remove! ' Widget'
name.prepend '.' if name.start_with? 'jqm'
name << ' event' if type == 'Events' && !name.end_with?(' event')
name
diff --git a/lib/docs/filters/jquery_ui/entries.rb b/lib/docs/filters/jquery_ui/entries.rb
index 38e5d41e..94e181d4 100644
--- a/lib/docs/filters/jquery_ui/entries.rb
+++ b/lib/docs/filters/jquery_ui/entries.rb
@@ -6,7 +6,7 @@ module Docs
def get_name
name = at_css('h1').content.strip
- name.sub! ' Widget', ''
+ name.remove! ' Widget'
name.gsub!(/ [A-Z]/) { |str| str.downcase! }
name
end
diff --git a/lib/docs/filters/knockout/entries.rb b/lib/docs/filters/knockout/entries.rb
index 0eb52d7b..910c4d8b 100644
--- a/lib/docs/filters/knockout/entries.rb
+++ b/lib/docs/filters/knockout/entries.rb
@@ -15,7 +15,7 @@ module Docs
def get_name
return NAME_BY_SLUG[slug] if NAME_BY_SLUG.has_key?(slug)
name = at_css('h1').content.strip
- name.sub! 'The ', ''
+ name.remove! 'The '
name.sub! %r{"(.+?)"}, '\1'
name.gsub!(/ [A-Z]/) { |str| str.downcase! }
name
diff --git a/lib/docs/filters/lodash/entries.rb b/lib/docs/filters/lodash/entries.rb
index 540e7568..cdffb170 100644
--- a/lib/docs/filters/lodash/entries.rb
+++ b/lib/docs/filters/lodash/entries.rb
@@ -6,7 +6,7 @@ module Docs
css('h2').each do |node|
type = node.content.split.first
- type.gsub! %r{\W}, '' # remove quotation marks
+ type.remove! %r{\W} # remove quotation marks
node.parent.css('h3').each do |heading|
name = heading.content
diff --git a/lib/docs/filters/moment/clean_html.rb b/lib/docs/filters/moment/clean_html.rb
index 5330bcc6..ef92b91a 100644
--- a/lib/docs/filters/moment/clean_html.rb
+++ b/lib/docs/filters/moment/clean_html.rb
@@ -4,7 +4,7 @@ module Docs
def call
# Set id attributes on headings
css('a.target').each do |node|
- node.next_element['id'] = node['name'].sub(/\A\//, '').sub(/\/\z/, '').gsub('/', '-')
+ node.next_element['id'] = node['name'].remove(/\A\//).remove(/\/\z/).gsub('/', '-')
end
css('> article', '.prose', 'h2 > a', 'h3 > a', 'pre > code').each do |node|
diff --git a/lib/docs/filters/moment/entries.rb b/lib/docs/filters/moment/entries.rb
index 09a4fea8..3c2bcea3 100644
--- a/lib/docs/filters/moment/entries.rb
+++ b/lib/docs/filters/moment/entries.rb
@@ -31,8 +31,8 @@ module Docs
name.prepend 'Language#'
else
name = node.content.strip
- name.sub! %r{\s[\d\.]+\z}, '' # remove version number
- name.sub! %r{\s\(.+\)\z}, '' # remove parenthesis
+ name.remove! %r{\s[\d\.]+\z} # remove version number
+ name.remove! %r{\s\(.+\)\z} # remove parenthesis
name.prepend 'Parse: ' if type == 'Parse'
end
diff --git a/lib/docs/filters/node/entries.rb b/lib/docs/filters/node/entries.rb
index 9d2b9e81..e3b0611c 100644
--- a/lib/docs/filters/node/entries.rb
+++ b/lib/docs/filters/node/entries.rb
@@ -54,8 +54,8 @@ module Docs
end
# Classes
- if name.sub! 'Class: ', ''
- name.sub! 'events.', '' # EventEmitter
+ if name.remove! 'Class: '
+ name.remove! 'events.' # EventEmitter
klass = name
entries << [name, node['id']]
next
@@ -70,7 +70,7 @@ module Docs
name.gsub! %r{\(.*?\)}, '()'
name.gsub! %r{\[.+?\]}, '[]'
- name.sub! 'assert(), ', '' # assert/assert.ok
+ name.remove! 'assert(), ' # assert/assert.ok
# Skip all that start with an uppercase letter ("Example") or include a space ("exports alias")
next unless (name.first.upcase! && !name.include?(' ')) || name.start_with?('Class Method')
@@ -80,15 +80,15 @@ module Docs
# Differentiate socket classes (net, dgram, etc.)
name.sub!('socket.') { "#{klass.sub('.', '_').downcase!}." }
- name.sub! 'Class Method:', ''
- name.sub! 'buf.', 'buffer.'
- name.sub! 'buf[', 'buffer['
- name.sub! 'child.', 'childprocess.'
- name.sub! 'decoder.', 'stringdecoder.'
- name.sub! 'emitter.', 'eventemitter.'
- name.sub! %r{\Arl\.}, 'interface.'
- name.sub! 'rs.', 'readstream.'
- name.sub! 'ws.', 'writestream.'
+ name.remove! 'Class Method:'
+ name.sub! 'buf.', 'buffer.'
+ name.sub! 'buf[', 'buffer['
+ name.sub! 'child.', 'childprocess.'
+ name.sub! 'decoder.', 'stringdecoder.'
+ name.sub! 'emitter.', 'eventemitter.'
+ name.sub! %r{\Arl\.}, 'interface.'
+ name.sub! 'rs.', 'readstream.'
+ name.sub! 'ws.', 'writestream.'
# Skip duplicates (listen, connect, etc.)
unless name == entries[-1].try(:first) || name == entries[-2].try(:first)
diff --git a/lib/docs/filters/php/entries.rb b/lib/docs/filters/php/entries.rb
index 39b538fa..836c9a30 100644
--- a/lib/docs/filters/php/entries.rb
+++ b/lib/docs/filters/php/entries.rb
@@ -82,7 +82,7 @@ module Docs
def get_name
return 'IntlException' if slug == 'class.intlexception'
name = css('> .sect1 > .title', 'h1', 'h2').first.content
- name.sub! 'The ', ''
+ name.remove! 'The '
name.sub! ' class', ' (class)'
name.sub! ' interface', ' (interface)'
name
@@ -91,7 +91,7 @@ module Docs
def get_type
type = at_css('.up').content.strip
type = 'SPL/Iterators' if type.end_with? 'Iterator'
- type.sub! ' Functions', ''
+ type.remove! ' Functions'
TYPE_BY_NAME_STARTS_WITH.each_pair do |key, value|
break type = value if name.start_with?(key)
diff --git a/lib/docs/filters/postgresql/entries.rb b/lib/docs/filters/postgresql/entries.rb
index 1436e5d4..583f1075 100644
--- a/lib/docs/filters/postgresql/entries.rb
+++ b/lib/docs/filters/postgresql/entries.rb
@@ -18,15 +18,15 @@ module Docs
if %w(Overview Introduction).include?(name)
result[:pg_chapter_name]
else
- name.sub! ' (Common Table Expressions)', ''
+ name.remove! ' (Common Table Expressions)'
REPLACE_NAMES[name] || name
end
end
def clean_heading_name(name)
- name.sub! %r{\A[\d\.\s]+}, ''
- name.sub! 'Using ', ''
- name.sub! %r{\AThe }, ''
+ name.remove! %r{\A[\d\.\s]+}
+ name.remove! 'Using '
+ name.remove! %r{\AThe }
name
end
@@ -41,7 +41,7 @@ module Docs
if type.start_with?('Func') && (match = name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/))
"Functions: #{match[1]}"
else
- type.sub 'SQL ', ''
+ type.remove 'SQL '
end
end
end
@@ -104,10 +104,10 @@ module Docs
def get_custom_entries(selector)
css(selector).inject [] do |entries, node|
name = node.content
- name.gsub! %r{\(.*?\)}m, ''
- name.gsub! %r{\[.*?\]}m, ''
+ name.remove! %r{\(.*?\)}m
+ name.remove! %r{\[.*?\]}m
name.squeeze! ' '
- name.sub! %r{\([^\)]*\z}, '' # bug fix: json_populate_record
+ name.remove! %r{\([^\)]*\z} # bug fix: json_populate_record
name = '||' if name.include? ' || '
id = name.gsub(/[^a-z0-9\-_]/) { |char| char.ord }
id = id.parameterize
@@ -129,7 +129,7 @@ module Docs
end
def additional_entry_prefix
- type.dup.sub!('Functions: ', '') || self.name
+ type.dup.remove!('Functions: ') || self.name
end
def skip_additional_entries?
diff --git a/lib/docs/filters/python/clean_html.rb b/lib/docs/filters/python/clean_html.rb
index c5ea0df4..b71e0649 100644
--- a/lib/docs/filters/python/clean_html.rb
+++ b/lib/docs/filters/python/clean_html.rb
@@ -38,7 +38,7 @@ module Docs
node.css('a').each do |link|
link.before(link.children).remove
end
- node.child.content = node.child.content.sub @levelRegexp, ''
+ node.child.content = node.child.content.remove @levelRegexp
end
css('dt').each do |node|
diff --git a/lib/docs/filters/python/entries.rb b/lib/docs/filters/python/entries.rb
index 16fb712e..61d5db7c 100644
--- a/lib/docs/filters/python/entries.rb
+++ b/lib/docs/filters/python/entries.rb
@@ -15,8 +15,8 @@ module Docs
def get_name
name = at_css('h1').content
- name.sub! %r{\A[\d\.]+ }, '' # remove list number
- name.sub! %r{ [\u{2013}\u{2014}].+\z}, '' # remove text after em/en dash
+ name.remove! %r{\A[\d\.]+ } # remove list number
+ name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash
name
end
@@ -33,10 +33,10 @@ module Docs
type = 'Internet Data Handling'
end
- type.sub! %r{\A\d+\.\s+}, '' # remove list number
- type.sub! "\u{00b6}", '' # remove paragraph character
+ type.remove! %r{\A\d+\.\s+} # remove list number
+ type.remove! "\u{00b6}" # remove paragraph character
type.sub! ' and ', ' & '
- [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.sub! str, '' }
+ [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.remove!(str) }
REPLACE_TYPES[type] || type
end
@@ -74,7 +74,7 @@ module Docs
def clean_id_attributes
css('.section > .target[id]').each do |node|
if dt = node.at_css('+ dl > dt')
- dt['id'] ||= node['id'].sub(/\w+\-/, '')
+ dt['id'] ||= node['id'].remove(/\w+\-/)
end
node.remove
end
diff --git a/lib/docs/filters/rdoc/entries.rb b/lib/docs/filters/rdoc/entries.rb
index 8aa8fd66..3bceda0b 100644
--- a/lib/docs/filters/rdoc/entries.rb
+++ b/lib/docs/filters/rdoc/entries.rb
@@ -3,15 +3,15 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content.strip
- name.sub! 'class ', ''
- name.sub! 'module ', ''
+ name.remove! 'class '
+ name.remove! 'module '
name
end
def get_type
type = name.dup
- unless type.sub! %r{::.*\z}, ''
+ unless type.remove! %r{::.*\z}
parent = at_css('.meta-parent').try(:content).to_s
return 'Errors' if type.end_with?('Error') || parent.end_with?('Error') || parent.end_with?('Exception')
end
@@ -29,8 +29,8 @@ module Docs
css('.method-detail').inject [] do |entries, node|
name = node['id'].dup
- name.sub! %r{\A\w+?\-.}, ''
- name.sub! %r{\A-(?!\d)}, ''
+ name.remove! %r{\A\w+?\-.}
+ name.remove! %r{\A-(?!\d)}
name.gsub! '-', '%'
name = CGI.unescape(name)
diff --git a/lib/docs/filters/sass/clean_html.rb b/lib/docs/filters/sass/clean_html.rb
index f9c0f46c..ce19c655 100644
--- a/lib/docs/filters/sass/clean_html.rb
+++ b/lib/docs/filters/sass/clean_html.rb
@@ -44,7 +44,7 @@ module Docs
# Remove links to type classes (e.g. Number)
css('.type > code').each do |node|
- node.before(node.content.sub('Sass::Script::Value::', '').sub('Sass::Script::', '')).remove
+ node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove
end
end
end
diff --git a/lib/docs/filters/sass/entries.rb b/lib/docs/filters/sass/entries.rb
index ae466e34..a20fd979 100644
--- a/lib/docs/filters/sass/entries.rb
+++ b/lib/docs/filters/sass/entries.rb
@@ -47,7 +47,7 @@ module Docs
next unless TYPES.include?(type)
name = node.content.strip
- name.sub! %r{\A.+?: }, ''
+ name.remove! %r{\A.+?: }
next if SKIP_NAMES.include?(name)
diff --git a/lib/docs/subscribers/filter_subscriber.rb b/lib/docs/subscribers/filter_subscriber.rb
index b6bb036b..a9bf0d96 100644
--- a/lib/docs/subscribers/filter_subscriber.rb
+++ b/lib/docs/subscribers/filter_subscriber.rb
@@ -3,7 +3,7 @@ module Docs
self.namespace = 'html_pipeline'
def call_filter(event)
- log "Filter: #{event.payload[:filter].sub('Docs::', '').sub('Filter', '')} [#{event.duration.round}ms]"
+ log "Filter: #{event.payload[:filter].remove('Docs::').remove('Filter')} [#{event.duration.round}ms]"
end
end
end
diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor
index 64731909..287b178a 100644
--- a/lib/tasks/docs.thor
+++ b/lib/tasks/docs.thor
@@ -17,7 +17,7 @@ class DocsCLI < Thor
Docs.all.
map { |doc| [doc.to_s.demodulize.underscore, doc] }.
each { |pair| max_length = pair.first.length if pair.first.length > max_length }.
- each { |pair| puts "#{pair.first.rjust max_length + 1}: #{pair.second.base_url.sub %r{\Ahttps?://}, ''}" }
+ each { |pair| puts "#{pair.first.rjust max_length + 1}: #{pair.second.base_url.remove %r{\Ahttps?://}}" }
end
desc 'page [path] [--verbose] [--debug]', 'Generate a page (no indexing)'
diff --git a/test/lib/docs/storage/file_store_test.rb b/test/lib/docs/storage/file_store_test.rb
index e638a522..e2775abf 100644
--- a/test/lib/docs/storage/file_store_test.rb
+++ b/test/lib/docs/storage/file_store_test.rb
@@ -124,7 +124,7 @@ class DocsFileStoreTest < MiniTest::Spec
describe "#each" do
let :paths do
paths = []
- store.each { |path| paths << path.sub(tmp_path, '') }
+ store.each { |path| paths << path.remove(tmp_path) }
paths
end