Unified · Split
| @@ -41,7 +41,7 @@ module Docs · 40 unmodified lines | ||
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | def slug |
| 44 | − @slug ||= subpath.sub(/\A\//, '').sub(/\.html\z/, '') | |
| 44 | + @slug ||= subpath.sub(/\A\//, '').remove(/\.html\z/) | |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | 47 | def root_page? |
| @@ -34,7 +34,7 @@ module Docs · 33 unmodified lines | ||
| 34 | 34 | end |
| 35 | 35 | |
| 36 | 36 | def file_path_for(url) |
| 37 | − File.join self.class.dir, url.sub(base_url.to_s, '') | |
| 37 | + File.join self.class.dir, url.remove(base_url.to_s) | |
| 38 | 38 | end |
| 39 | 39 | |
| 40 | 40 | def read_file(path) |
| @@ -17,11 +17,11 @@ module Docs · 16 unmodified lines | ||
| 17 | 17 | end |
| 18 | 18 | |
| 19 | 19 | def format_url(url) |
| 20 | − url.to_s.sub %r{\Ahttps?://}, '' | |
| 20 | + url.to_s.remove %r{\Ahttps?://} | |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | def format_path(path) |
| 24 | − path.to_s.sub File.join(File.expand_path('.'), ''), '' | |
| 24 | + path.to_s.remove File.join(File.expand_path('.'), '') | |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | 27 | def justify(str) |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | 5 | name = slug.split(':').last |
| 6 | − name.sub! %r{\Ang\.}, '' | |
| 6 | + name.remove! %r{\Ang\.} | |
| 7 | 7 | name << " (#{subtype})" if subtype == 'directive' || subtype == 'filter' |
| 8 | 8 | name |
| 9 | 9 | end |
| @@ -8,7 +8,7 @@ module Docs · 7 unmodified lines | ||
| 8 | 8 | css('[id]').each do |node| |
| 9 | 9 | # Module |
| 10 | 10 | if node.name == 'h2' |
| 11 | − type = node.content.sub 'Backbone.', '' | |
| 11 | + type = node.content.remove 'Backbone.' | |
| 12 | 12 | if type.capitalize! # sync, history |
| 13 | 13 | entries << [node.content, node['id'], type] |
| 14 | 14 | end |
| @@ -35,7 +35,7 @@ module Docs · 34 unmodified lines | ||
| 35 | 35 | end |
| 36 | 36 | |
| 37 | 37 | css('area[href]').each do |node| |
| 38 | − node['href'] = node['href'].sub('.html', '') | |
| 38 | + node['href'] = node['href'].remove('.html') | |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | 41 | doc |
| @@ -15,8 +15,8 @@ module Docs · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | def get_name |
| 17 | 17 | name = at_css('#firstHeading').content.strip |
| 18 | − name.sub! 'C keywords: ', '' | |
| 19 | − name.sub! %r{\s\(.+\)}, '' | |
| 18 | + name.remove! 'C keywords: ' | |
| 19 | + name.remove! %r{\s\(.+\)} | |
| 20 | 20 | name = name.split(',').first |
| 21 | 21 | REPLACE_NAMES[name] || name |
| 22 | 22 | end |
| @@ -24,8 +24,8 @@ module Docs · 1 unmodified line | ||
| 24 | 24 | def get_type |
| 25 | 25 | if type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) |
| 26 | 26 | type.strip! |
| 27 | − type.sub! ' library', '' | |
| 28 | − type.sub! ' utilities', '' | |
| 27 | + type.remove! ' library' | |
| 28 | + type.remove! ' utilities' | |
| 29 | 29 | type |
| 30 | 30 | end |
| 31 | 31 | end |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | def call |
| 6 | 6 | html.strip! |
| 7 | − while html.gsub!(EMPTY_NODES_RGX, ''); end | |
| 7 | + while html.remove!(EMPTY_NODES_RGX); end | |
| 8 | 8 | html |
| 9 | 9 | end |
| 10 | 10 | end |
| @@ -21,7 +21,7 @@ module Docs · 20 unmodified lines | ||
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | def normalized_subpath |
| 24 | − normalize_path subpath.sub(/\A\//, '') | |
| 24 | + normalize_path subpath.remove(/\A\//) | |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | 27 | def normalize_href(href) |
| @@ -10,10 +10,10 @@ module Docs · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | def get_name |
| 12 | 12 | name = at_css('#firstHeading').content.strip |
| 13 | − name.sub! 'C++ concepts: ', '' | |
| 14 | − name.sub! 'C++ keywords: ', '' | |
| 15 | − name.sub! 'C++ ', '' | |
| 16 | − name.sub! %r{\s\(.+\)}, '' | |
| 13 | + name.remove! 'C++ concepts: ' | |
| 14 | + name.remove! 'C++ keywords: ' | |
| 15 | + name.remove! 'C++ ' | |
| 16 | + name.remove! %r{\s\(.+\)} | |
| 17 | 17 | name.sub! %r{\AStandard library header <(.+)>\z}, '\1' |
| 18 | 18 | name = name.split(',').first |
| 19 | 19 | REPLACE_NAMES[name] || name |
| @@ -24,9 +24,9 @@ module Docs · 4 unmodified lines | ||
| 24 | 24 | 'Keywords' |
| 25 | 25 | elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) |
| 26 | 26 | type.strip! |
| 27 | − type.sub! ' library', '' | |
| 28 | − type.sub! ' utilities', '' | |
| 29 | − type.sub! 'C++ ', '' | |
| 27 | + type.remove! ' library' | |
| 28 | + type.remove! ' utilities' | |
| 29 | + type.remove! 'C++ ' | |
| 30 | 30 | type.capitalize! |
| 31 | 31 | type |
| 32 | 32 | end |
| @@ -34,7 +34,7 @@ module Docs · 1 unmodified line | ||
| 34 | 34 | |
| 35 | 35 | def additional_entries |
| 36 | 36 | return [] unless include_default_entry? |
| 37 | − names = at_css('#firstHeading').content.gsub(%r{\(.+?\)}, '').split(',')[1..-1] | |
| 37 | + names = at_css('#firstHeading').content.remove(%r{\(.+?\)}).split(',')[1..-1] | |
| 38 | 38 | names.each(&:strip!).reject! do |name| |
| 39 | 39 | name.size <= 2 || name == '...' || name =~ /\A[<>]/ || name.start_with?('operator') |
| 40 | 40 | end |
| @@ -60,7 +60,7 @@ module Docs · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | def get_name |
| 62 | 62 | case type |
| 63 | − when 'Data Types' then "<#{super.gsub(' value', '')}>" | |
| 63 | + when 'Data Types' then "<#{super.remove ' value'}>" | |
| 64 | 64 | when 'Functions' then "#{super}()" |
| 65 | 65 | else super |
| 66 | 66 | end |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def call |
| 5 | 5 | # Remove links inside <h2> and add "id" attributes |
| 6 | 6 | css('h2 > a').each do |node| |
| 7 | − node.parent['id'] = node['name'].sub('wiki-', '') if node['name'] | |
| 7 | + node.parent['id'] = node['name'].remove('wiki-') if node['name'] | |
| 8 | 8 | node.before(node.children).remove |
| 9 | 9 | end |
| 10 | 10 | |
| @@ -26,7 +26,7 @@ module Docs · 15 unmodified lines | ||
| 26 | 26 | next unless node['name'] || node.content == '#' |
| 27 | 27 | parent = node.parent |
| 28 | 28 | parent.name = 'h6' |
| 29 | − parent['id'] = (node['name'] || node['href'].sub(/\A.+#/, '')).sub('wiki-', '') | |
| 29 | + parent['id'] = (node['name'] || node['href'].remove(/\A.+#/)).remove('wiki-') | |
| 30 | 30 | parent.css('a[name]').remove |
| 31 | 31 | node.remove |
| 32 | 32 | end |
| @@ -12,7 +12,7 @@ module Docs · 11 unmodified lines | ||
| 12 | 12 | def additional_entries |
| 13 | 13 | css('h6[id]').inject [] do |entries, node| |
| 14 | 14 | name = node.content |
| 15 | − name.sub! %r{\(.*\z}, '' | |
| 15 | + name.remove! %r{\(.*\z} | |
| 16 | 16 | entries << [name, node['id']] unless name == entries.last.try(:first) |
| 17 | 17 | entries |
| 18 | 18 | end |
| @@ -18,7 +18,7 @@ module Docs · 17 unmodified lines | ||
| 18 | 18 | end |
| 19 | 19 | |
| 20 | 20 | css('> h1').each do |node| |
| 21 | − node.content = node.content.sub(/\(\d\) Manual Page/, '') | |
| 21 | + node.content = node.content.remove(/\(\d\) Manual Page/) | |
| 22 | 22 | end |
| 23 | 23 | |
| 24 | 24 | unless at_css('> h2') |
| @@ -18,7 +18,7 @@ module Docs · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | # Remove triangle character |
| 20 | 20 | css('h2', '.exampleHeading').each do |node| |
| 21 | − node.content = node.content.sub("\u25BE", '') | |
| 21 | + node.content = node.content.remove("\u25BE") | |
| 22 | 22 | node.name = 'h2' |
| 23 | 23 | end |
| 24 | 24 | |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | 5 | name = at_css('h1').content |
| 6 | − name.sub! 'Package ', '' | |
| 6 | + name.remove! 'Package ' | |
| 7 | 7 | name |
| 8 | 8 | end |
| 9 | 9 | |
| @@ -19,9 +19,9 @@ module Docs · 18 unmodified lines | ||
| 19 | 19 | name |
| 20 | 20 | else |
| 21 | 21 | name = super |
| 22 | − name.sub! 'Functions and function scope.', '' | |
| 23 | − name.sub! 'Operators.', '' | |
| 24 | − name.sub! 'Statements.', '' | |
| 22 | + name.remove! 'Functions and function scope.' | |
| 23 | + name.remove! 'Operators.' | |
| 24 | + name.remove! 'Statements.' | |
| 25 | 25 | name |
| 26 | 26 | end |
| 27 | 27 | end |
| @@ -34,7 +34,7 @@ module Docs · 6 unmodified lines | ||
| 34 | 34 | elsif slug.start_with? 'Functions_and_function_scope' |
| 35 | 35 | 'Function' |
| 36 | 36 | elsif slug.start_with? 'Global_Objects' |
| 37 | − object, method = *slug.sub('Global_Objects/', '').split('/') | |
| 37 | + object, method = *slug.remove('Global_Objects/').split('/') | |
| 38 | 38 | if object.end_with? 'Error' |
| 39 | 39 | 'Errors' |
| 40 | 40 | elsif INTL_OBJECTS.include?(object) |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | def get_name |
| 8 | 8 | name = at_css('h1').content.strip |
| 9 | − name.sub! ' Widget', '' | |
| 9 | + name.remove! ' Widget' | |
| 10 | 10 | name.prepend '.' if name.start_with? 'jqm' |
| 11 | 11 | name << ' event' if type == 'Events' && !name.end_with?(' event') |
| 12 | 12 | name |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | def get_name |
| 8 | 8 | name = at_css('h1').content.strip |
| 9 | − name.sub! ' Widget', '' | |
| 9 | + name.remove! ' Widget' | |
| 10 | 10 | name.gsub!(/ [A-Z]/) { |str| str.downcase! } |
| 11 | 11 | name |
| 12 | 12 | end |
| @@ -15,7 +15,7 @@ module Docs · 14 unmodified lines | ||
| 15 | 15 | def get_name |
| 16 | 16 | return NAME_BY_SLUG[slug] if NAME_BY_SLUG.has_key?(slug) |
| 17 | 17 | name = at_css('h1').content.strip |
| 18 | − name.sub! 'The ', '' | |
| 18 | + name.remove! 'The ' | |
| 19 | 19 | name.sub! %r{"(.+?)"}, '\1' |
| 20 | 20 | name.gsub!(/ [A-Z]/) { |str| str.downcase! } |
| 21 | 21 | name |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | css('h2').each do |node| |
| 8 | 8 | type = node.content.split.first |
| 9 | − type.gsub! %r{\W}, '' # remove quotation marks | |
| 9 | + type.remove! %r{\W} # remove quotation marks | |
| 10 | 10 | |
| 11 | 11 | node.parent.css('h3').each do |heading| |
| 12 | 12 | name = heading.content |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def call |
| 5 | 5 | # Set id attributes on headings |
| 6 | 6 | css('a.target').each do |node| |
| 7 | − node.next_element['id'] = node['name'].sub(/\A\//, '').sub(/\/\z/, '').gsub('/', '-') | |
| 7 | + node.next_element['id'] = node['name'].remove(/\A\//).remove(/\/\z/).gsub('/', '-') | |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | css('> article', '.prose', 'h2 > a', 'h3 > a', 'pre > code').each do |node| |
| @@ -31,8 +31,8 @@ module Docs · 30 unmodified lines | ||
| 31 | 31 | name.prepend 'Language#' |
| 32 | 32 | else |
| 33 | 33 | name = node.content.strip |
| 34 | − name.sub! %r{\s[\d\.]+\z}, '' # remove version number | |
| 35 | − name.sub! %r{\s\(.+\)\z}, '' # remove parenthesis | |
| 34 | + name.remove! %r{\s[\d\.]+\z} # remove version number | |
| 35 | + name.remove! %r{\s\(.+\)\z} # remove parenthesis | |
| 36 | 36 | name.prepend 'Parse: ' if type == 'Parse' |
| 37 | 37 | end |
| 38 | 38 | |
| @@ -54,8 +54,8 @@ module Docs · 53 unmodified lines | ||
| 54 | 54 | end |
| 55 | 55 | |
| 56 | 56 | # Classes |
| 57 | − if name.sub! 'Class: ', '' | |
| 58 | − name.sub! 'events.', '' # EventEmitter | |
| 57 | + if name.remove! 'Class: ' | |
| 58 | + name.remove! 'events.' # EventEmitter | |
| 59 | 59 | klass = name |
| 60 | 60 | entries << [name, node['id']] |
| 61 | 61 | next |
| @@ -70,7 +70,7 @@ module Docs · 8 unmodified lines | ||
| 70 | 70 | |
| 71 | 71 | name.gsub! %r{\(.*?\)}, '()' |
| 72 | 72 | name.gsub! %r{\[.+?\]}, '[]' |
| 73 | − name.sub! 'assert(), ', '' # assert/assert.ok | |
| 73 | + name.remove! 'assert(), ' # assert/assert.ok | |
| 74 | 74 | |
| 75 | 75 | # Skip all that start with an uppercase letter ("Example") or include a space ("exports alias") |
| 76 | 76 | next unless (name.first.upcase! && !name.include?(' ')) || name.start_with?('Class Method') |
| @@ -80,15 +80,15 @@ module Docs · 3 unmodified lines | ||
| 80 | 80 | # Differentiate socket classes (net, dgram, etc.) |
| 81 | 81 | name.sub!('socket.') { "#{klass.sub('.', '_').downcase!}." } |
| 82 | 82 | |
| 83 | − name.sub! 'Class Method:', '' | |
| 84 | − name.sub! 'buf.', 'buffer.' | |
| 85 | − name.sub! 'buf[', 'buffer[' | |
| 86 | − name.sub! 'child.', 'childprocess.' | |
| 87 | − name.sub! 'decoder.', 'stringdecoder.' | |
| 88 | − name.sub! 'emitter.', 'eventemitter.' | |
| 89 | − name.sub! %r{\Arl\.}, 'interface.' | |
| 90 | − name.sub! 'rs.', 'readstream.' | |
| 91 | − name.sub! 'ws.', 'writestream.' | |
| 83 | + name.remove! 'Class Method:' | |
| 84 | + name.sub! 'buf.', 'buffer.' | |
| 85 | + name.sub! 'buf[', 'buffer[' | |
| 86 | + name.sub! 'child.', 'childprocess.' | |
| 87 | + name.sub! 'decoder.', 'stringdecoder.' | |
| 88 | + name.sub! 'emitter.', 'eventemitter.' | |
| 89 | + name.sub! %r{\Arl\.}, 'interface.' | |
| 90 | + name.sub! 'rs.', 'readstream.' | |
| 91 | + name.sub! 'ws.', 'writestream.' | |
| 92 | 92 | |
| 93 | 93 | # Skip duplicates (listen, connect, etc.) |
| 94 | 94 | unless name == entries[-1].try(:first) || name == entries[-2].try(:first) |
| @@ -82,7 +82,7 @@ module Docs · 81 unmodified lines | ||
| 82 | 82 | def get_name |
| 83 | 83 | return 'IntlException' if slug == 'class.intlexception' |
| 84 | 84 | name = css('> .sect1 > .title', 'h1', 'h2').first.content |
| 85 | − name.sub! 'The ', '' | |
| 85 | + name.remove! 'The ' | |
| 86 | 86 | name.sub! ' class', ' (class)' |
| 87 | 87 | name.sub! ' interface', ' (interface)' |
| 88 | 88 | name |
| @@ -91,7 +91,7 @@ module Docs · 2 unmodified lines | ||
| 91 | 91 | def get_type |
| 92 | 92 | type = at_css('.up').content.strip |
| 93 | 93 | type = 'SPL/Iterators' if type.end_with? 'Iterator' |
| 94 | − type.sub! ' Functions', '' | |
| 94 | + type.remove! ' Functions' | |
| 95 | 95 | |
| 96 | 96 | TYPE_BY_NAME_STARTS_WITH.each_pair do |key, value| |
| 97 | 97 | break type = value if name.start_with?(key) |
| @@ -18,15 +18,15 @@ module Docs · 17 unmodified lines | ||
| 18 | 18 | if %w(Overview Introduction).include?(name) |
| 19 | 19 | result[:pg_chapter_name] |
| 20 | 20 | else |
| 21 | − name.sub! ' (Common Table Expressions)', '' | |
| 21 | + name.remove! ' (Common Table Expressions)' | |
| 22 | 22 | REPLACE_NAMES[name] || name |
| 23 | 23 | end |
| 24 | 24 | end |
| 25 | 25 | |
| 26 | 26 | def clean_heading_name(name) |
| 27 | − name.sub! %r{\A[\d\.\s]+}, '' | |
| 28 | − name.sub! 'Using ', '' | |
| 29 | − name.sub! %r{\AThe }, '' | |
| 27 | + name.remove! %r{\A[\d\.\s]+} | |
| 28 | + name.remove! 'Using ' | |
| 29 | + name.remove! %r{\AThe } | |
| 30 | 30 | name |
| 31 | 31 | end |
| 32 | 32 | |
| @@ -41,7 +41,7 @@ module Docs · 8 unmodified lines | ||
| 41 | 41 | if type.start_with?('Func') && (match = name.match(/\A(?!Form|Seq|Set|Enum)(.+) Func/)) |
| 42 | 42 | "Functions: #{match[1]}" |
| 43 | 43 | else |
| 44 | − type.sub 'SQL ', '' | |
| 44 | + type.remove 'SQL ' | |
| 45 | 45 | end |
| 46 | 46 | end |
| 47 | 47 | end |
| @@ -104,10 +104,10 @@ module Docs · 56 unmodified lines | ||
| 104 | 104 | def get_custom_entries(selector) |
| 105 | 105 | css(selector).inject [] do |entries, node| |
| 106 | 106 | name = node.content |
| 107 | − name.gsub! %r{\(.*?\)}m, '' | |
| 108 | − name.gsub! %r{\[.*?\]}m, '' | |
| 107 | + name.remove! %r{\(.*?\)}m | |
| 108 | + name.remove! %r{\[.*?\]}m | |
| 109 | 109 | name.squeeze! ' ' |
| 110 | − name.sub! %r{\([^\)]*\z}, '' # bug fix: json_populate_record | |
| 110 | + name.remove! %r{\([^\)]*\z} # bug fix: json_populate_record | |
| 111 | 111 | name = '||' if name.include? ' || ' |
| 112 | 112 | id = name.gsub(/[^a-z0-9\-_]/) { |char| char.ord } |
| 113 | 113 | id = id.parameterize |
| @@ -129,7 +129,7 @@ module Docs · 15 unmodified lines | ||
| 129 | 129 | end |
| 130 | 130 | |
| 131 | 131 | def additional_entry_prefix |
| 132 | − type.dup.sub!('Functions: ', '') || self.name | |
| 132 | + type.dup.remove!('Functions: ') || self.name | |
| 133 | 133 | end |
| 134 | 134 | |
| 135 | 135 | def skip_additional_entries? |
| @@ -38,7 +38,7 @@ module Docs · 37 unmodified lines | ||
| 38 | 38 | node.css('a').each do |link| |
| 39 | 39 | link.before(link.children).remove |
| 40 | 40 | end |
| 41 | − node.child.content = node.child.content.sub @levelRegexp, '' | |
| 41 | + node.child.content = node.child.content.remove @levelRegexp | |
| 42 | 42 | end |
| 43 | 43 | |
| 44 | 44 | css('dt').each do |node| |
| @@ -15,8 +15,8 @@ module Docs · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | def get_name |
| 17 | 17 | name = at_css('h1').content |
| 18 | − name.sub! %r{\A[\d\.]+ }, '' # remove list number | |
| 19 | − name.sub! %r{ [\u{2013}\u{2014}].+\z}, '' # remove text after em/en dash | |
| 18 | + name.remove! %r{\A[\d\.]+ } # remove list number | |
| 19 | + name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash | |
| 20 | 20 | name |
| 21 | 21 | end |
| 22 | 22 | |
| @@ -33,10 +33,10 @@ module Docs · 10 unmodified lines | ||
| 33 | 33 | type = 'Internet Data Handling' |
| 34 | 34 | end |
| 35 | 35 | |
| 36 | − type.sub! %r{\A\d+\.\s+}, '' # remove list number | |
| 37 | − type.sub! "\u{00b6}", '' # remove paragraph character | |
| 36 | + type.remove! %r{\A\d+\.\s+} # remove list number | |
| 37 | + type.remove! "\u{00b6}" # remove paragraph character | |
| 38 | 38 | type.sub! ' and ', ' & ' |
| 39 | − [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.sub! str, '' } | |
| 39 | + [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.remove!(str) } | |
| 40 | 40 | |
| 41 | 41 | REPLACE_TYPES[type] || type |
| 42 | 42 | end |
| @@ -74,7 +74,7 @@ module Docs · 31 unmodified lines | ||
| 74 | 74 | def clean_id_attributes |
| 75 | 75 | css('.section > .target[id]').each do |node| |
| 76 | 76 | if dt = node.at_css('+ dl > dt') |
| 77 | − dt['id'] ||= node['id'].sub(/\w+\-/, '') | |
| 77 | + dt['id'] ||= node['id'].remove(/\w+\-/) | |
| 78 | 78 | end |
| 79 | 79 | node.remove |
| 80 | 80 | end |
| @@ -3,15 +3,15 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | 5 | name = at_css('h1').content.strip |
| 6 | − name.sub! 'class ', '' | |
| 7 | − name.sub! 'module ', '' | |
| 6 | + name.remove! 'class ' | |
| 7 | + name.remove! 'module ' | |
| 8 | 8 | name |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | 11 | def get_type |
| 12 | 12 | type = name.dup |
| 13 | 13 | |
| 14 | − unless type.sub! %r{::.*\z}, '' | |
| 14 | + unless type.remove! %r{::.*\z} | |
| 15 | 15 | parent = at_css('.meta-parent').try(:content).to_s |
| 16 | 16 | return 'Errors' if type.end_with?('Error') || parent.end_with?('Error') || parent.end_with?('Exception') |
| 17 | 17 | end |
| @@ -29,8 +29,8 @@ module Docs · 11 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | css('.method-detail').inject [] do |entries, node| |
| 31 | 31 | name = node['id'].dup |
| 32 | − name.sub! %r{\A\w+?\-.}, '' | |
| 33 | − name.sub! %r{\A-(?!\d)}, '' | |
| 32 | + name.remove! %r{\A\w+?\-.} | |
| 33 | + name.remove! %r{\A-(?!\d)} | |
| 34 | 34 | name.gsub! '-', '%' |
| 35 | 35 | name = CGI.unescape(name) |
| 36 | 36 | |
| @@ -44,7 +44,7 @@ module Docs · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | # Remove links to type classes (e.g. Number) |
| 46 | 46 | css('.type > code').each do |node| |
| 47 | − node.before(node.content.sub('Sass::Script::Value::', '').sub('Sass::Script::', '')).remove | |
| 47 | + node.before(node.content.remove('Sass::Script::Value::').remove('Sass::Script::')).remove | |
| 48 | 48 | end |
| 49 | 49 | end |
| 50 | 50 | end |
| @@ -47,7 +47,7 @@ module Docs · 46 unmodified lines | ||
| 47 | 47 | next unless TYPES.include?(type) |
| 48 | 48 | |
| 49 | 49 | name = node.content.strip |
| 50 | − name.sub! %r{\A.+?: }, '' | |
| 50 | + name.remove! %r{\A.+?: } | |
| 51 | 51 | |
| 52 | 52 | next if SKIP_NAMES.include?(name) |
| 53 | 53 | |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | self.namespace = 'html_pipeline' |
| 4 | 4 | |
| 5 | 5 | def call_filter(event) |
| 6 | − log "Filter: #{event.payload[:filter].sub('Docs::', '').sub('Filter', '')} [#{event.duration.round}ms]" | |
| 6 | + log "Filter: #{event.payload[:filter].remove('Docs::').remove('Filter')} [#{event.duration.round}ms]" | |
| 7 | 7 | end |
| 8 | 8 | end |
| 9 | 9 | end |
| @@ -17,7 +17,7 @@ class DocsCLI < Thor · 16 unmodified lines | ||
| 17 | 17 | Docs.all. |
| 18 | 18 | map { |doc| [doc.to_s.demodulize.underscore, doc] }. |
| 19 | 19 | each { |pair| max_length = pair.first.length if pair.first.length > max_length }. |
| 20 | − each { |pair| puts "#{pair.first.rjust max_length + 1}: #{pair.second.base_url.sub %r{\Ahttps?://}, ''}" } | |
| 20 | + each { |pair| puts "#{pair.first.rjust max_length + 1}: #{pair.second.base_url.remove %r{\Ahttps?://}}" } | |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 23 | desc 'page <doc> [path] [--verbose] [--debug]', 'Generate a page (no indexing)' |
| @@ -124,7 +124,7 @@ class DocsFileStoreTest < MiniTest::Spec · 123 unmodified lines | ||
| 124 | 124 | describe "#each" do |
| 125 | 125 | let :paths do |
| 126 | 126 | paths = [] |
| 127 | − store.each { |path| paths << path.sub(tmp_path, '') } | |
| 127 | + store.each { |path| paths << path.remove(tmp_path) } | |
| 128 | 128 | paths |
| 129 | 129 | end |
| 130 | 130 | |