blacklight 7.15.1 → 7.15.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab13b2ca3b5250f0ef85bb4f3b64f949a4c646b4f39e83ce5002bb26f40df1da
|
4
|
+
data.tar.gz: ceeb2e13d5dd1fa7459c6c743087043728ba680c7cf935365912198af3de736b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89889eeb5499865e09a8b9b4887fadf3784ff449b92de38a2619f29371ddce31015b39a45e5feb78a0193195751d1e7982e4b776995e49f17839979126eb4177
|
7
|
+
data.tar.gz: d7913a9cd2a87b01b8e657bc0cf7427fd1e7cae7d6c82a4ceb3d9e1842bfdfefdbf2689ff637593728d6176f032e3e8737405d04aac713f1ae3e0f926d51f719
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.15.
|
1
|
+
7.15.2
|
@@ -4,7 +4,9 @@ module Blacklight
|
|
4
4
|
##
|
5
5
|
# An OpenStruct that responds to common Hash methods
|
6
6
|
class OpenStructWithHashAccess < OpenStruct
|
7
|
-
delegate :keys, :each, :map, :has_key?, :key?, :include?, :empty?,
|
7
|
+
delegate :keys, :each, :map, :has_key?, :key?, :include?, :empty?,
|
8
|
+
:length, :delete, :delete_if, :keep_if, :clear, :reject!, :select!,
|
9
|
+
:replace, :fetch, :to_json, :as_json, :any?, to: :to_h
|
8
10
|
|
9
11
|
##
|
10
12
|
# Expose the internal hash
|
@@ -45,5 +47,20 @@ module Blacklight
|
|
45
47
|
def deep_dup
|
46
48
|
self.class.new @table.deep_dup
|
47
49
|
end
|
50
|
+
|
51
|
+
if Rails.version < '6'
|
52
|
+
# Ported from Rails 6 to fix an incompatibility with ostruct
|
53
|
+
def try(method_name = nil, *args, &block)
|
54
|
+
if method_name.nil? && block_given?
|
55
|
+
if b.arity.zero?
|
56
|
+
instance_eval(&block)
|
57
|
+
else
|
58
|
+
yield self
|
59
|
+
end
|
60
|
+
elsif respond_to?(method_name)
|
61
|
+
public_send(method_name, *args, &b)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
48
65
|
end
|
49
66
|
end
|
@@ -145,4 +145,12 @@ RSpec.describe Blacklight::OpenStructWithHashAccess do
|
|
145
145
|
expect(copy.b[:c]).to eq 2
|
146
146
|
end
|
147
147
|
end
|
148
|
+
|
149
|
+
describe "#try" do
|
150
|
+
subject { described_class.new a: 1 }
|
151
|
+
|
152
|
+
it "works (and doesn't throw a stack error...)" do
|
153
|
+
expect(subject.try(:a)).to eq 1
|
154
|
+
end
|
155
|
+
end
|
148
156
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.15.
|
4
|
+
version: 7.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date: 2021-02
|
20
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|