blacklight 7.15.1 → 7.15.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: 8c361c374c8af05f8f0104e57699a41ccc32af93ceefa4f37ecdb036d10931a9
4
- data.tar.gz: 1243d79f46fc64008b804b1e6fb78ceeb4a73fb95c235624adc5257b6d3098a5
3
+ metadata.gz: ab13b2ca3b5250f0ef85bb4f3b64f949a4c646b4f39e83ce5002bb26f40df1da
4
+ data.tar.gz: ceeb2e13d5dd1fa7459c6c743087043728ba680c7cf935365912198af3de736b
5
5
  SHA512:
6
- metadata.gz: dd26f409ddc7382b884ec3e9de4ad2f9ac437707d7ee7d0256e0f1603c9da2cea82f954d2ea83724873ce9a965fc9c7187d14af73ef948d03d7a43d77736628f
7
- data.tar.gz: 0d9682303fdfc23e100ee2ed83bf9c077dcbdc013417f6b371ad40bf49cdd7b1b91e1847342036cad8eadf8d04acd4bba057f661c63ef791a8239c032cc448f1
6
+ metadata.gz: 89889eeb5499865e09a8b9b4887fadf3784ff449b92de38a2619f29371ddce31015b39a45e5feb78a0193195751d1e7982e4b776995e49f17839979126eb4177
7
+ data.tar.gz: d7913a9cd2a87b01b8e657bc0cf7427fd1e7cae7d6c82a4ceb3d9e1842bfdfefdbf2689ff637593728d6176f032e3e8737405d04aac713f1ae3e0f926d51f719
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.15.1
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?, :length, :delete, :delete_if, :keep_if, :clear, :reject!, :select!, :replace, :fetch, :to_json, :as_json, :any?, to: :to_h
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.1
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-11 00:00:00.000000000 Z
20
+ date: 2021-03-02 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails