obfuscatable 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +17 -1
- data/lib/obfuscatable/version.rb +1 -1
- data/lib/obfuscatable.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a11262060d7dfacf58142a7fea4abac160d10cf
|
|
4
|
+
data.tar.gz: 06dec14883d5dcc68313a7b76453ccdd91679e1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73171c997655ef182170f79ec2983f06bd0cf5455516b5aea00848060990b97f7e04a1f8ed1a78a9614be42af4c789d78cec5dd567df4e75cdebe290ca7494da
|
|
7
|
+
data.tar.gz: c6603111c3a008c50718d5a9fe106eed915c05a0efe55a27bc7807fdbb47b00e02e69803e02493fab34600dbf7893cbe05e626cf99e69797eda09e4232e65e82
|
data/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# obfuscatable
|
|
2
2
|
|
|
3
|
-
[![
|
|
3
|
+
[![Gem Version][gem-image]][gem-link]
|
|
4
|
+
[![Dependency Status][deps-image]][deps-link]
|
|
5
|
+
[![Build Status][build-image]][build-link]
|
|
6
|
+
[![Code Climate][gpa-image]][gpa-link]
|
|
4
7
|
|
|
5
8
|
**Make your ActiveRecord ids non-obvious**
|
|
6
9
|
|
|
@@ -56,3 +59,16 @@ class Post < ActiveRecord::Base
|
|
|
56
59
|
obfuscatable :spin => 89238723
|
|
57
60
|
end
|
|
58
61
|
```
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
[gem-image]: https://badge.fury.io/rb/obfuscatable.svg
|
|
67
|
+
[gem-link]: http://badge.fury.io/rb/obfuscatable
|
|
68
|
+
[build-image]: https://travis-ci.org/dtaniwaki/obfuscatable.svg
|
|
69
|
+
[build-link]: http://travis-ci.org/dtaniwaki/obfuscatable
|
|
70
|
+
[deps-image]: https://gemnasium.com/dtaniwaki/obfuscatable.png
|
|
71
|
+
[deps-link]: https://gemnasium.com/dtaniwaki/obfuscatable
|
|
72
|
+
[gpa-image]: https://codeclimate.com/github/dtaniwaki/obfuscatable/badges/gpa.svg
|
|
73
|
+
[gpa-link]: https://codeclimate.com/github/dtaniwaki/obfuscatable
|
|
74
|
+
|
data/lib/obfuscatable/version.rb
CHANGED
data/lib/obfuscatable.rb
CHANGED
|
@@ -3,7 +3,7 @@ module Obfuscatable
|
|
|
3
3
|
def obfuscatable(options = {})
|
|
4
4
|
require 'scatter_swap'
|
|
5
5
|
|
|
6
|
-
extend ClassMethods
|
|
6
|
+
extend ClassMethods
|
|
7
7
|
include InstanceMethods
|
|
8
8
|
cattr_accessor :obfuscatable_spin
|
|
9
9
|
self.obfuscatable_spin = (options[:spin] || obfuscatable_default_spin)
|
|
@@ -26,7 +26,7 @@ module Obfuscatable
|
|
|
26
26
|
if scope.is_a?(Array)
|
|
27
27
|
scope.map! {|a| deobfuscatable(a).to_i}
|
|
28
28
|
else
|
|
29
|
-
scope = deobfuscatable(scope)
|
|
29
|
+
scope = deobfuscatable(scope).to_i
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
find(scope)
|
|
@@ -44,7 +44,7 @@ module Obfuscatable
|
|
|
44
44
|
# This makes it easy to drop obfuscatable onto any model
|
|
45
45
|
# and produce different obfuscated ids for different models
|
|
46
46
|
def obfuscatable_default_spin
|
|
47
|
-
alphabet = Array("a".."z")
|
|
47
|
+
alphabet = Array("a".."z")
|
|
48
48
|
number = name.split("").collect do |char|
|
|
49
49
|
alphabet.index(char)
|
|
50
50
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: obfuscatable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daisuke Taniwaki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: scatter_swap
|
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
154
|
version: '0'
|
|
155
155
|
requirements: []
|
|
156
156
|
rubyforge_project:
|
|
157
|
-
rubygems_version: 2.
|
|
157
|
+
rubygems_version: 2.4.3
|
|
158
158
|
signing_key:
|
|
159
159
|
specification_version: 4
|
|
160
160
|
summary: Mask ActiveRecord IDs
|