active_object 5.8.8 → 5.8.9

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: 467b3ff3ed965d1993beb11434c8ead0d178a0c13fdb2c084d9653c8879a5276
4
- data.tar.gz: f58d3b7bb9526ccdb2ccd8be5010e90e15e4b7f6ebcd58adc1c096e07da9b950
3
+ metadata.gz: 731cfd2c3d3dc9d643246fa34facf69837460c7f3d4a03bc23e340227888e05c
4
+ data.tar.gz: 203ea4a794ea73ec297fef2c8e6e8cf2515e5785b7b9d7e2652936da52b0c027
5
5
  SHA512:
6
- metadata.gz: 03abb73322c9a69e9a65012cceaa2117c4301e2cbbe982b28e4a70eadf83c482b4f2a120330738ebd8d64309e46ea28245cbef1754441d9cc08e2b8a900ea8f3
7
- data.tar.gz: 85b759f31eee8fd41fbceddc930aa3cce754a521f8395068e1f7d104eb12421b6e589e1404ce60e064a9448f7370e9e2cdacbb10e30ce4066a9cfe590d7786dc
6
+ metadata.gz: b8eef7bfb289c87f1f9e1ff7e7b30bafb781d05e0ba29ba9d6d5a095c0be0a93b2f3bc9b9e813aafc02a20c8b9c75a76681ef145f62d7b51c9d664f421a5f43f
7
+ data.tar.gz: 33fe831f6f8210efc17d057f24d5017e860a64201ab26ae0cd7f5212058b4923d165f4484007d134b7a8036d86670d1a340a7ab74148548a3497398846889da8
data/README.md CHANGED
@@ -1566,10 +1566,11 @@ true.falsey? #=> false
1566
1566
  `safe_call` execute caller to an object and rescues with self.
1567
1567
 
1568
1568
  ```ruby
1569
- callr = -> { 3 * 3 }
1569
+ callr = ->(x) { 3 * x }
1570
1570
 
1571
- 3.safe_call #=> 3
1572
- callr.safe_call #=> 9
1571
+ 3.safe_call #=> 3
1572
+ callr.safe_call(3) #=> 9
1573
+ callr.safe_call #=> raises ArgumentError: wrong number of arguments
1573
1574
  ```
1574
1575
 
1575
1576
  **Safe Send:**
@@ -1671,10 +1672,11 @@ false.truthy? #=> false
1671
1672
  `try_call` execute caller to an object and rescues with nil.
1672
1673
 
1673
1674
  ```ruby
1674
- callr = -> { 3 * 3 }
1675
+ callr = ->(x) { 3 * x }
1675
1676
 
1676
- 3.try_call #=> nil
1677
- callr.try_call #=> 9
1677
+ 3.try_call #=> nil
1678
+ callr.try_call(3) #=> 9
1679
+ callr.try_call #=> raises ArgumentError: wrong number of arguments
1678
1680
  ```
1679
1681
 
1680
1682
  **Try Send:**
@@ -69,8 +69,8 @@ module ActiveObject
69
69
  is_a?(Range)
70
70
  end
71
71
 
72
- def safe_call
73
- try_call || self
72
+ def safe_call(*keys)
73
+ try_call(*keys) || self
74
74
  end
75
75
 
76
76
  def safe_send(*keys)
@@ -129,10 +129,11 @@ module ActiveObject
129
129
  end
130
130
  end
131
131
 
132
- def try_call
132
+ def try_call(*keys)
133
133
  return unless respond_to?(:call)
134
134
 
135
- call
135
+
136
+ keys.blank? ? call : call(*keys)
136
137
  end
137
138
 
138
139
  def try_send(*keys)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveObject
4
- VERSION ||= '5.8.8'
4
+ VERSION ||= '5.8.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.8
4
+ version: 5.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez