eac_ruby_utils 0.43.0 → 0.44.0
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/lib/eac_ruby_utils/patches/object/if_respond.rb +22 -0
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bfd8e12446b005875a4071e96d64bce7d841a5459537c846632d303f4d89e05
|
4
|
+
data.tar.gz: cce1b321a2aa297cddc211d646ef8b471fdfda3d7ed4eac3eb690e69ce8772e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e02f7e7aeb5cb1b1cf54f92abcfe46dfad970c7d637e412d0bb3bb35872dcbb8f4104e8cf7275dc071fb00fd5b29b9a292f9849f2c2ede1239deaec2b32c7f09
|
7
|
+
data.tar.gz: bd1af262c50b1205e15a9e63d70f2929132b7c89c6036b5ddb0f3d25f94590ff6cf05f82151dd7cb3f4e7c8ccad3cd1b5f4878a271f3ab471d59b85d2f73f7f5
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/object/blank'
|
4
|
+
|
5
|
+
class Object
|
6
|
+
# @return +block.call(self.method_name)+ if +self+ responds to +method_name+, +default_value+
|
7
|
+
# otherwise.
|
8
|
+
def if_respond(method_name, default_value = nil)
|
9
|
+
return default_value unless respond_to?(method_name)
|
10
|
+
|
11
|
+
value = send(method_name)
|
12
|
+
|
13
|
+
block_given? ? yield(value) : value
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return +yield+ if +self+ is blank.
|
17
|
+
def if_blank
|
18
|
+
return yield if blank? && block_given?
|
19
|
+
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.44.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/eac_ruby_utils/patches/object.rb
|
193
193
|
- lib/eac_ruby_utils/patches/object/asserts.rb
|
194
194
|
- lib/eac_ruby_utils/patches/object/if_present.rb
|
195
|
+
- lib/eac_ruby_utils/patches/object/if_respond.rb
|
195
196
|
- lib/eac_ruby_utils/patches/object/template.rb
|
196
197
|
- lib/eac_ruby_utils/patches/object/to_pathname.rb
|
197
198
|
- lib/eac_ruby_utils/patches/pathname.rb
|
@@ -242,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
243
|
- !ruby/object:Gem::Version
|
243
244
|
version: '0'
|
244
245
|
requirements: []
|
245
|
-
rubygems_version: 3.0.
|
246
|
+
rubygems_version: 3.0.8
|
246
247
|
signing_key:
|
247
248
|
specification_version: 4
|
248
249
|
summary: Utilities for E.A.C.'s Ruby projects.
|