Skip to content

Commit c7a24c7

Browse files
committed
Add nocov markers
Also, make the Erubi.h documentation display with rdoc.
1 parent 5910021 commit c7a24c7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/erubi.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,27 @@ module Erubi
1313
RANGE_FIRST = 0..0
1414
RANGE_LAST = -1..-1
1515
TEXT_END = "';"
16+
# :nocov:
1617
end
1718

1819
MATCH_METHOD = RUBY_VERSION >= '2.4' ? :match? : :match
1920

2021
begin
2122
require 'cgi/escape'
23+
# :nocov:
2224
unless CGI.respond_to?(:escapeHTML) # work around for JRuby 9.1
2325
CGI = Object.new
2426
CGI.extend(defined?(::CGI::Escape) ? ::CGI::Escape : ::CGI::Util)
2527
end
28+
# :nocov:
29+
# Escape characters with their HTML/XML equivalents.
2630
def self.h(value)
2731
CGI.escapeHTML(value.to_s)
2832
end
2933
rescue LoadError
34+
# :nocov:
3035
ESCAPE_TABLE = {'&' => '&amp;'.freeze, '<' => '&lt;'.freeze, '>' => '&gt;'.freeze, '"' => '&quot;'.freeze, "'" => '&#39;'.freeze}.freeze
3136
if RUBY_VERSION >= '1.9'
32-
# Escape the following characters with their HTML/XML
33-
# equivalents.
3437
def self.h(value)
3538
value.to_s.gsub(/[&<>"']/, ESCAPE_TABLE)
3639
end
@@ -39,6 +42,7 @@ def self.h(value)
3942
value.to_s.gsub(/[&<>"']/){|s| ESCAPE_TABLE[s]}
4043
end
4144
end
45+
# :nocov:
4246
end
4347

4448
class Engine

0 commit comments

Comments
 (0)