html-stripper 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c4a9340ee61abc0e55e2be773e4b6a5c2e05be5fb9ed124f4ef93884454cd39f
4
+ data.tar.gz: 7fb075a1d358b9df34aa6cde6f4ed7138882710218f6da99b9dd919d87703145
5
+ SHA512:
6
+ metadata.gz: 87f8253838397cda34ff6e51bfccf465414a91511606ae8a1d44d95f805859fe938f4e210fee592a0dd3c869d4832e71ed95d66d69b77798a2d9a4490430d2eb
7
+ data.tar.gz: 1ee320010d232ca26b7101bd2911314ffa74dea84a97fc3b05ae7d58c9f1c45a8319c7957e51b38514bb57a35b1497cb5854d17effa02c6987c21ac6160b2ec2
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in html-stripper.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Marcos Nogueira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Html::Stripper
2
+
3
+ HTML Stripper removes all HTML from a ActiveRecord model column
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'html-stripper'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install html-stripper
20
+
21
+ ## Usage
22
+
23
+ class YourModel < ApplicationRecord
24
+ strip_html :name, :email, :description
25
+ end
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/html-stripper.
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "html/stripper"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,20 @@
1
+ require_relative "lib/html_stripper/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "html-stripper"
5
+ spec.version = HtmlStripper::VERSION
6
+ spec.authors = ["Marcos Nogueira"]
7
+ spec.email = ["marcosnogueiraalves@gmail.com"]
8
+
9
+ spec.summary = "HTML Stripper removes all HTML from a ActiveRecord model column"
10
+ spec.description = "HTML Stripper removes all HTML from a ActiveRecord model column"
11
+ spec.homepage = "https://github.com/marcosnogueira/html-stripper"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
15
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
16
+ end
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'html_stripper/version'
2
+ require_relative 'html_stripper/model_stripper'
3
+
4
+ module HtmlStripper
5
+ class Error < StandardError; end
6
+ end
7
+
8
+ ActiveSupport.on_load(:active_record) do
9
+ extend HtmlStripper::ModelStripper
10
+ end
@@ -0,0 +1,11 @@
1
+ module HtmlStripper
2
+ module ModelStripper
3
+ def strip_html(*columns)
4
+ columns.each do |column|
5
+ define_method :"#{column}=" do |value|
6
+ super(ActionView::Base.full_sanitizer.sanitize(value))
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module HtmlStripper
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: html-stripper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marcos Nogueira
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: HTML Stripper removes all HTML from a ActiveRecord model column
14
+ email:
15
+ - marcosnogueiraalves@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - bin/console
25
+ - bin/setup
26
+ - html-stripper.gemspec
27
+ - lib/html-stripper.rb
28
+ - lib/html_stripper/model_stripper.rb
29
+ - lib/html_stripper/version.rb
30
+ homepage: https://github.com/marcosnogueira/html-stripper
31
+ licenses:
32
+ - MIT
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 3.1.6
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: HTML Stripper removes all HTML from a ActiveRecord model column
53
+ test_files: []