KraVs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/KraVs.rb +26 -0
  3. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: aa34edbf03b81361e9df3dd6d89cd4f960660ff36fa0696d3ca787bd7637364b
4
+ data.tar.gz: 11f8761f60d6670862dbf37f0b3348bee99296d7767025120f8d89a1148cce41
5
+ SHA512:
6
+ metadata.gz: 8512a9a2b7e51998413b567002a6af202b2e8c22fe354ca418df14894831163c09f85645e10b2ce9a25393ec9ddda13fbfc689140bf1a0fa76709936984457e7
7
+ data.tar.gz: 444888157821ff4897178ec3c196f6d15f7daf59c2f5edd2ff79c5c76944922c00e639774baa33b36a34c74b68270316d23fc36627ec4afa7e39c8ee14cd77c4
data/lib/KraVs.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'sanitize'
2
+
3
+ class KraVs
4
+ def add_content (content, file_name: 'index.html', bypass_html: false)
5
+ @content = content
6
+ @content = Sanitize.fragment(content).gsub(/[<>]/, '') unless bypass_html
7
+ File.open(file_name, 'w') do |f|
8
+ html <<~HTML
9
+ <!DOCTYPE html>
10
+ <html lang="en">
11
+ <head>
12
+ <meta charset="UTF-8">
13
+ < title>KraVs </title>
14
+ </head>
15
+ <body>
16
+ <div class ='info'>
17
+ #{@content}
18
+ </div>
19
+ </body>
20
+ </html>
21
+ HTML
22
+ f.write.html
23
+ end
24
+ end
25
+ end
26
+ s
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: KraVs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andriy Koroviakovskiy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-11-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/KraVs.rb
20
+ homepage:
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubygems_version: 3.3.11
39
+ signing_key:
40
+ specification_version: 4
41
+ summary: A gem to save content in HTML file
42
+ test_files: []