who_delegated 0.4.0 → 0.5.0

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: 824595368318fdb41b9df5aa1395f72757e3b32084f91d3f53186f5ec573cc1f
4
- data.tar.gz: e5bcb33dadac09dc8e5f72fc848e8ca89de8352a5dec33a206145fc2b159a01b
3
+ metadata.gz: f855d48a56878ec7dd784743524fd00ff6bc1d3d02de09fd1def373785c8fc11
4
+ data.tar.gz: bdb870c715b8db194db9986333931b843409ef74196f7e6e164863964a250649
5
5
  SHA512:
6
- metadata.gz: 0162ccf2b4518a3e9dcd0d38f1faab1a4241c689af44717228c7d5f7dd681461762422768280e890a8189656e87d9c94e564177227a8868e8aa7fb2666ed76a2
7
- data.tar.gz: 550108ca612898136f825022ec34c1baea207822dcaca5dd7662649a711dd189b040cf0af6384083b9365f48416eec52c907707b95be037b0592e232bcbee992
6
+ metadata.gz: 4e9dbea9d0bbcff53d237527fcc2b54b153d8504834a1bb20dcdad65266808d24a3493850e20afd2d9ad2908cd7c0d6d5176b0d982fac5fa5a6a388281d42ff0
7
+ data.tar.gz: c8ac87b2c12eb9e7c3ad2155d255d2e6ac81550ab65c674d55733f9f51949ee416f12802d439f3da7b3b90f94ccc661db8867526482765b751a4fa173745e452
data/lib/module.rb CHANGED
@@ -6,7 +6,11 @@ class Module
6
6
  def delegate(*methods, to: nil, prefix: nil, allow_nil: nil, private: nil)
7
7
  if defined?(ActiveRecord::Base) && self < ActiveRecord::Base
8
8
  methods.each do |method|
9
- define_method("delegated_#{"#{prefix == true ? to : prefix}_" if prefix}#{method}?") do
9
+ method_name = "delegated_#{"#{prefix == true ? to : prefix}_" if prefix}#{method}?"
10
+ define_singleton_method(method_name) do
11
+ respond_to?(method)
12
+ end
13
+ define_method(method_name) do
10
14
  to
11
15
  end
12
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhoDelegated
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: who_delegated
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampo Kuokkanen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-22 00:00:00.000000000 Z
11
+ date: 2024-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails