pseudonymize 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c647b6dcabc59b4ca99e1241579215de90c1683906347ef7c4e7a5e0cc3ee473
4
- data.tar.gz: 9ce512d0e5a4f48cb5d6ef76ad085e371771b7c7e0b5d8645b92b377de6c407d
3
+ metadata.gz: df86ac5a5539143ae490b2b513e8673508a36fdb447c5cae8af590ca6ff2857b
4
+ data.tar.gz: ebec5358756c63da5acf8938b7dd683c161efed93e6a4ef52d720f82b58107c3
5
5
  SHA512:
6
- metadata.gz: edf416c6d8d87b6c89dce2ebb92d76a6f8c689b5637645d2a69110bb868fbcf8d761344b3e56cca23df69944a1eba2143a19024e068c6881938d9b51bd7e1c69
7
- data.tar.gz: 3d5a45ba46eb9b362216c3d30fdecf6bbd16db8a8b33c19b5e402e6bda00b2766014db9606902eb41b2323ab14c0059e97d2970894d2a3cac1b563f73a800824
6
+ metadata.gz: 8383c5e048685433fa48714999db089aa17cfd28cda76b70c42d5c6eee5ee95197e1326cfd3e1e0778ce287f42d60fa019a6a28d252350f02b3e619f9f752193
7
+ data.tar.gz: fb354ac9483fe12d3a02b904a308baf37157fa6a74a89a07a3f23749102154d5eb4266c8171951935c90208de9b8c384ad06926764b6638d4ee9c4ec93ee974c
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Restaurantgids Eet.nu
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # pseudonymize
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -0,0 +1,22 @@
1
+ module Pseudonymize
2
+ class Email
3
+ attr_reader :options
4
+
5
+ def initialize(email, **options)
6
+ @email = email
7
+ @options = options
8
+ end
9
+
10
+ def result
11
+ user, host = @email.split('@')
12
+
13
+ if user.length > 2
14
+ user = user[0] + (options[:censor] * (user.length - 1))
15
+ else
16
+ user = (options[:censor] * user.length)
17
+ end
18
+
19
+ "#{user}@#{host}"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ module Pseudonymize
2
+ class Name
3
+ attr_reader :options
4
+
5
+ def initialize(name, **options)
6
+ @name = name
7
+ @options = options
8
+ end
9
+
10
+ def result
11
+ @name.split.map do |name|
12
+ "#{name[0].upcase}#{options[:censor] * (name.length - 1)}"
13
+ end.join(' ')
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ module Pseudonymize
2
+ class Telephone
3
+ attr_reader :options
4
+
5
+ def initialize(telephone, **options)
6
+ @telephone = telephone
7
+ @options = options
8
+ end
9
+
10
+ def result
11
+ characters = @telephone.chars
12
+ unhidden = (characters.length / 2)
13
+ last = (unhidden.to_f / 2).ceil
14
+ first = unhidden - last
15
+
16
+ [
17
+ characters[0..first],
18
+ (options[:censor] * (characters.length - first - last - 1)),
19
+ characters[-last, last]
20
+ ].flatten.join
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'pseudonymize'
3
+ s.version = '0.0.2'
4
+ s.date = '2018-05-14'
5
+ s.summary = "A gem that pseudonymizes data."
6
+ s.description = "A gem that pseudonymizes data."
7
+ s.authors = ["Tom-Eric Gerritsen"]
8
+ s.email = 'tomeric@eet.nu'
9
+ s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test)/}) }
10
+ s.homepage = 'http://rubygems.org/gems/pseudonymize'
11
+ s.license = 'MIT'
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pseudonymize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom-Eric Gerritsen
@@ -16,7 +16,15 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
+ - ".gitignore"
20
+ - LICENSE
21
+ - README.md
22
+ - Rakefile
19
23
  - lib/pseudonymize.rb
24
+ - lib/pseudonymize/email.rb
25
+ - lib/pseudonymize/name.rb
26
+ - lib/pseudonymize/telephone.rb
27
+ - pseudonymize.gemspec
20
28
  homepage: http://rubygems.org/gems/pseudonymize
21
29
  licenses:
22
30
  - MIT