voltron-encrypt 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 597cd10990fe75cd332d71680ac6ae7358f53a53
4
- data.tar.gz: b0dbe9159823c75b37c6a440464c092fdf49cb79
3
+ metadata.gz: 278557400ef5996ade0a48d3e1ebee0a87b33ffd
4
+ data.tar.gz: 012b9e1797827875d2233e47379b7cf95d0229f4
5
5
  SHA512:
6
- metadata.gz: d35c51eec9a79b68578c7d11df7e0de3b5020286c45af709d63cda953d80e7899d843d43b6a0241f564b3ac28c63ca6db49bd5398189bee97f27b16e575e12f1
7
- data.tar.gz: 63a04ee97e95f518fec3272e247fceb1f94446d9288761b374be9a245e549f404b5a9c7539c2ee76671f99ace115bbb5330efa7d6ff1a373b20566f7bc4186e7
6
+ metadata.gz: 95bd857aabae26567eb21d75844c83545af403a09977be7278ff5814ea40d65917f73195387e8b56bcefed87e498bcea1cc80bdb2da6a66c9546d4957f6f7703
7
+ data.tar.gz: 94463817979f129f636ac7a5c7500b1da19c1fc9850783f375609a8cdbd9bf940899d899d8d0940614b6c65cbeebfc313cc9be32d9831f4a35f4b4518d55a848
@@ -39,7 +39,7 @@ module Voltron
39
39
  encoded = encode(input)
40
40
 
41
41
  pattern = ["\\b([_\\-])*"]
42
- encoded.split("").each do |c|
42
+ encoded.chars.each do |c|
43
43
  subs = translations[c.downcase] || []
44
44
  c = "\\#{c}" if c == "-"
45
45
  pattern << "[#{c}#{subs.join}]([_\\-])*"
@@ -76,7 +76,7 @@ module Voltron
76
76
 
77
77
  def digits
78
78
  rnd = Random.new(Voltron.config.encrypt.seed.to_s.to_i(24))
79
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("").shuffle(random: rnd)
79
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".chars.shuffle(random: rnd)
80
80
  end
81
81
  end
82
82
  end
@@ -6,28 +6,22 @@ module Voltron
6
6
  def ids_writer(ids)
7
7
  if klass.has_encrypted_id?
8
8
  ids.reject!(&:blank?)
9
- replace(klass.find(ids))
9
+ records = klass.find(ids)
10
+ replace(Array.wrap(records))
10
11
  else
11
12
  super ids
12
13
  end
13
14
  end
14
15
 
15
16
  def ids_reader
16
- if loaded?
17
- load_target.map do |record|
18
- if klass.has_encrypted_id?
19
- record.to_param
20
- else
21
- record.send(reflection.association_primary_key)
22
- end
23
- end
24
- else
25
- if klass.has_encrypted_id?
26
- scope.map(&:to_param)
17
+ if klass.has_encrypted_id?
18
+ if loaded?
19
+ load_target.map(&:to_param)
27
20
  else
28
- column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}"
29
- scope.pluck(column)
21
+ scope.map(&:to_param)
30
22
  end
23
+ else
24
+ super
31
25
  end
32
26
  end
33
27
 
@@ -1,5 +1,5 @@
1
1
  module Voltron
2
2
  class Encrypt
3
- VERSION = "0.1.5".freeze
3
+ VERSION = "0.1.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voltron-encrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hainer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2016-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails