travis-ci
5 of 5 new or added lines in 1 file covered. (100.0%)
326 of 770 relevant lines covered (42.34%)
1.79 hits per line
1 |
require 'hanami/utils/escape'
|
3 all except jruby-9.0.5.0 ✔ |
2 |
|
|
3 |
module Hanami |
3 all except jruby-9.0.5.0 ✔ |
4 |
module Helpers |
3 all except jruby-9.0.5.0 ✔ |
5 |
module HtmlHelper |
3 all except jruby-9.0.5.0 ✔ |
6 |
# Text node. Allows for text to be inserted between HTML tags.
|
|
7 |
#
|
|
8 |
# @since 0.2.5
|
|
9 |
# @api private
|
|
10 |
class TextNode |
3 all except jruby-9.0.5.0 ✔ |
11 |
# Initialize a new text node
|
|
12 |
#
|
|
13 |
# @param content [String,#to_s] The content to be added.
|
|
14 |
#
|
|
15 |
# @return [Hanami::Helpers::HtmlHelper::TextNode]
|
|
16 |
#
|
|
17 |
# @since 0.2.5
|
|
18 |
# @api private
|
|
19 |
def initialize(content) |
3 all except jruby-9.0.5.0 ✔ |
20 |
@content = content.to_s
|
× |
21 |
end
|
|
22 |
|
|
23 |
# Resolve and return the output
|
|
24 |
#
|
|
25 |
# @return [String] the output
|
|
26 |
#
|
|
27 |
# @since 0.2.5
|
|
28 |
# @api private
|
|
29 |
def to_s |
3 all except jruby-9.0.5.0 ✔ |
30 |
Utils::Escape.html(@content) |
× |
31 |
end
|
|
32 |
end
|
|
33 |
end
|
|
34 |
end
|
|
35 |
end
|