order_already 0.3.1 → 0.3.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: 53d7a220ae782eabbe029a0e45f909d1b605b07b881e612b09150819b5cafdc6
4
- data.tar.gz: 364e044bd3e6b73201f87987cec8f98f09e49d9ef14152bbbdad7c9623bca900
3
+ metadata.gz: e9133e5102bbf4b0b4f6ef2207ee536e63dc6ac7d44181aedae6f1e179ebd22c
4
+ data.tar.gz: 69ce14225f00f535e165be4c951692bdb5d7c372595e59c9bd2ba9c51496d009
5
5
  SHA512:
6
- metadata.gz: cb6868e1c646a11440e211b90afb49d4662a5312fdd49f75fec4f3cadef7508a72c6af8a99b9f8db46148de56b5be6741a37eddc52af5f39e7dbec8e51571cd7
7
- data.tar.gz: 441506b2660ff35e8555e451401ed9ae73db8008a233755f77d6e7d4ec61b903d8244bf54f85e052b99571671c1408316a34c35d89ae2d74f396b787bedb2052
6
+ metadata.gz: 76eca41dc67a98dd12273bbd49eb4a4f21db9d2540ed976939adb4c66099a1d9216c2d178667536ff4e79f4a41b85c71f8dfa5fab9dbfdf9886130b98ab2041e
7
+ data.tar.gz: '04979a7b87e416ac7d81df70a3f4f8c2e12f7b1b04211c879dc86cdb13124c8ebdbea5010fb76e52c5b87edc10030497444248c269c05db4f776038097626921'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OrderAlready
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
data/lib/order_already.rb CHANGED
@@ -81,7 +81,9 @@ module OrderAlready
81
81
  # @param arr [Array]
82
82
  # @return [Array]
83
83
  def self.deserialize(arr)
84
- return [] if arr&.empty?
84
+ arr = arr&.compact || []
85
+ arr = arr.reject(&:empty?)
86
+ return [] if arr.empty?
85
87
 
86
88
  sort(arr).map do |val|
87
89
  get_value(val)
@@ -95,7 +97,9 @@ module OrderAlready
95
97
  # @param arr [Array]
96
98
  # @return [Array]
97
99
  def self.serialize(arr)
98
- return [] if arr&.empty?
100
+ arr = arr&.compact || []
101
+ arr = arr.reject(&:empty?)
102
+ return [] if arr.empty?
99
103
 
100
104
  arr = sanitize(arr)
101
105
 
@@ -108,6 +112,8 @@ module OrderAlready
108
112
  end
109
113
 
110
114
  def self.sanitize(values)
115
+ return if values.nil?
116
+
111
117
  full_sanitizer = Rails::Html::FullSanitizer.new
112
118
  sanitized_values = Array.new(values.size, '')
113
119
  empty = TOKEN_DELIMITER * 3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: order_already
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-03-03 00:00:00.000000000 Z
12
+ date: 2024-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails-html-sanitizer
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.3.7
103
+ rubygems_version: 3.5.3
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: A tiny gem to provide naive sorting for Fedora Commons properties.