hache 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/hache.rb +5 -3
- data/test/hache_test.rb +3 -4
- metadata +9 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b81ee9e1f8b86b0c5861f4be30b3196a7900721
|
4
|
+
data.tar.gz: 6b29e4df342426ae7d96061cd631731839ea696e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 323c10fe06beb5d776b03f40cefb56aedb9511fb44e21b224a51b6aa74f39cb4d375c24d79af44fc9ed5f1be7de160772a7ffc12394a4b124ba5ee47363229bc
|
7
|
+
data.tar.gz: 4f334a5b1eb7aa6bcee1af173e130f6322676128fbf61f2d82eb74d292ba0c08afe34b7c2a0f2e12d0daa09aeafc1a390cc956d5ac308c565891ae31a3d64e43
|
data/README.md
CHANGED
data/lib/hache.rb
CHANGED
@@ -5,13 +5,15 @@ module Hache
|
|
5
5
|
"&" => "&",
|
6
6
|
">" => ">",
|
7
7
|
"<" => "<",
|
8
|
-
'"
|
9
|
-
"'
|
8
|
+
"'" => "'",
|
9
|
+
'"' => """
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
UNSAFE = /[&"'><]/
|
13
13
|
|
14
|
-
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def h(s)
|
15
17
|
s.to_str.gsub(UNSAFE, HTML_ESCAPE)
|
16
18
|
end
|
17
19
|
end
|
data/test/hache_test.rb
CHANGED
@@ -3,15 +3,14 @@
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "minitest/autorun"
|
5
5
|
require "minitest/pride"
|
6
|
-
require "minitest/sugar"
|
7
6
|
require_relative "../lib/hache"
|
8
7
|
|
9
8
|
class HacheTest < Minitest::Test
|
10
|
-
|
9
|
+
def test_escape_safe_string
|
11
10
|
assert_equal "hola", Hache.h("hola")
|
12
11
|
end
|
13
12
|
|
14
|
-
|
15
|
-
assert_equal "<>&'
|
13
|
+
def test_escape_unsafe_chars
|
14
|
+
assert_equal "<>&"'", Hache.h(%q(<>&"'))
|
16
15
|
end
|
17
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Rodríguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -24,48 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.8'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: minitest-sugar
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.1'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.1'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '11
|
33
|
+
version: '11'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '11
|
40
|
+
version: '11'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rubocop
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
47
|
+
version: '0.49'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
54
|
+
version: '0.49'
|
69
55
|
description: 'Escapes HTML tag characters: &, <, >, ", '''
|
70
56
|
email: frodsan@protonmail.com
|
71
57
|
executables: []
|
@@ -96,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
82
|
version: '0'
|
97
83
|
requirements: []
|
98
84
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.6.11
|
100
86
|
signing_key:
|
101
87
|
specification_version: 4
|
102
88
|
summary: 'Escapes HTML tag characters: &, <, >, ", '''
|