hache 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/hache.rb +5 -3
  4. data/test/hache_test.rb +3 -4
  5. metadata +9 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25a75f94107f7e747e86b28bc3b43a12fc96a546
4
- data.tar.gz: d91c19440ea292ae3bd1482f8eb5e0ff5ca6fe57
3
+ metadata.gz: 4b81ee9e1f8b86b0c5861f4be30b3196a7900721
4
+ data.tar.gz: 6b29e4df342426ae7d96061cd631731839ea696e
5
5
  SHA512:
6
- metadata.gz: edc4f746d068152f7145439a0ce63b19383b2b3841aa0c692bed5499f831fa4ff726c621662b168bc9603a9aa67f641aef1080239376b450a17b0c51e23e415e
7
- data.tar.gz: 8c87072c39d6812d2bd62c2f48e13f18f59305e19743694b25bb236903d07aef3fe3a802acecb09fa11265000b2f260367d0b0e0308846dab5a15b099120aa30
6
+ metadata.gz: 323c10fe06beb5d776b03f40cefb56aedb9511fb44e21b224a51b6aa74f39cb4d375c24d79af44fc9ed5f1be7de160772a7ffc12394a4b124ba5ee47363229bc
7
+ data.tar.gz: 4f334a5b1eb7aa6bcee1af173e130f6322676128fbf61f2d82eb74d292ba0c08afe34b7c2a0f2e12d0daa09aeafc1a390cc956d5ac308c565891ae31a3d64e43
data/README.md CHANGED
@@ -30,7 +30,7 @@ Usage
30
30
  ```ruby
31
31
  require "hache"
32
32
 
33
- Hache.h(%q(<>&"')) == "&lt;&gt;&amp;&#39;&#34;"
33
+ Hache.h(%q(<>&"')) == "&lt;&gt;&amp;&#34;&#39;"
34
34
  # => true
35
35
  ```
36
36
 
@@ -5,13 +5,15 @@ module Hache
5
5
  "&" => "&amp;",
6
6
  ">" => "&gt;",
7
7
  "<" => "&lt;",
8
- '"' => "&#39;",
9
- "'" => "&#34;"
8
+ "'" => "&#39;",
9
+ '"' => "&#34;"
10
10
  }.freeze
11
11
 
12
12
  UNSAFE = /[&"'><]/
13
13
 
14
- def self.h(s)
14
+ module_function
15
+
16
+ def h(s)
15
17
  s.to_str.gsub(UNSAFE, HTML_ESCAPE)
16
18
  end
17
19
  end
@@ -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
- test "not escapes safe string" do
9
+ def test_escape_safe_string
11
10
  assert_equal "hola", Hache.h("hola")
12
11
  end
13
12
 
14
- test "escapes unsafe characters" do
15
- assert_equal "&lt;&gt;&amp;&#39;&#34;", Hache.h(%q(<>&"'))
13
+ def test_escape_unsafe_chars
14
+ assert_equal "&lt;&gt;&amp;&#34;&#39;", 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: 2.0.0
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: 2016-06-01 00:00:00.000000000 Z
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.0'
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.0'
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.39'
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.39'
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.5.1
85
+ rubygems_version: 2.6.11
100
86
  signing_key:
101
87
  specification_version: 4
102
88
  summary: 'Escapes HTML tag characters: &, <, >, ", '''