active_object 5.8.4 → 5.8.5

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: 4f85f337c5e525d8639566b7135d1fc452465bccaa9cd5a1aaaaf8e358f8c626
4
- data.tar.gz: b3f5f41bae092a6c628fc3dc36653895d4887a81e67b62cc37c1c04c0b05f269
3
+ metadata.gz: d32aae93b64f1afb0192f9c0ef6b37cc9ce507c65ed4f8bcf7fddc471259d7ca
4
+ data.tar.gz: c7b08130c77ff1f6db7bf8ee30dfd0aed4077bd73168aea0e8c1a63a4cc289ff
5
5
  SHA512:
6
- metadata.gz: 62d9b863f804470eae1543e13fe2baddb2be1a44b762632c085f2b647dbb865506602a3998bbb27643d8328de31b2d3cd10e342e01420bf29957b15a1507c8aa
7
- data.tar.gz: 3164e6a80312254681be06126d0136be1e22725e09562a246a9bf923a627e085ca43a7641953b52ccf8416630878bf20d2cce6dff25b45b6a07d2f4667a04333
6
+ metadata.gz: d1043ad6c682e71c5cd6a93fc0534957112b646d9946908253d35fec65454007800e68047604b65ee1ec0c0ba64349b5aa39bd2a16b9b5e1439a6c9c270a007c
7
+ data.tar.gz: 47f590d4eaf88cdeece8ccc61417cf54402065f9d06e00b07176d5c3519506e03608725001385b35d0ae5427693521a7b098a67918b7e1640d6ba173039e1512
data/.reek.yml CHANGED
@@ -32,6 +32,8 @@ detectors:
32
32
  exclude:
33
33
  - 'ActiveObject::Array#in_groups'
34
34
  - 'ActiveObject::Configuration#initialize'
35
+ UncommunicativeMethodName:
36
+ enabled: false
35
37
  UncommunicativeVariableName:
36
38
  accept:
37
39
  - '/^.$/'
data/README.md CHANGED
@@ -1562,6 +1562,14 @@ true.falsey? #=> false
1562
1562
  1.range? #=> false
1563
1563
  ```
1564
1564
 
1565
+ **Safe Send:**
1566
+ `safe_send` execute caller to an object and rescues with self.
1567
+
1568
+ ```ruby
1569
+ 3.safe_send(:fake) #=> 3
1570
+ 3.safe_send(:to_s) #=> '3'
1571
+ ```
1572
+
1565
1573
  **Salvage:**
1566
1574
  `salvage` returns a placeholder if object is blank?.
1567
1575
 
@@ -23,14 +23,12 @@ if ActiveObject.configuration.autoload_kernel
23
23
 
24
24
  private
25
25
 
26
- # rubocop:disable Style/PerlBackrefs
27
26
  def caller_name(depth = 0)
28
27
  val = caller[depth][CALLER_METHOD_REGEX, 1]
29
28
  return val if depth.zero? || !val.include?('<top (required)>')
30
29
 
31
30
  caller[depth - 1][CALLER_METHOD_REGEX, 1]
32
31
  end
33
- # rubocop:enable Style/PerlBackrefs
34
32
 
35
33
  end
36
34
  end
@@ -69,6 +69,10 @@ module ActiveObject
69
69
  is_a?(Range)
70
70
  end
71
71
 
72
+ def safe_send(key)
73
+ send(key) rescue self
74
+ end
75
+
72
76
  def salvage(placeholder = '---')
73
77
  blank? ? placeholder : self
74
78
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveObject
4
- VERSION ||= '5.8.4'
4
+ VERSION ||= '5.8.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.4
4
+ version: 5.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler