tapioca 0.1.4 → 0.1.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: 75a87d3c876d0f813f47a8d40065ff30543661787819493d32b6116f387d1408
4
- data.tar.gz: a546890d23895b079d35b37b326b604ae77d08b8219adda3b259f1a8042fa255
3
+ metadata.gz: 8843a601bd4e5a685e116ee6c85e4045d1373efa827a74d0a81fdfbf010e81b5
4
+ data.tar.gz: 4692376ebaa71712f5979cf9dbdfe926556011ab49c237dde05c7ef59817da12
5
5
  SHA512:
6
- metadata.gz: b8d394ddbf391ce726b55e252631362b10ad0e2ed868e673253b7ebd1b9817d0290784ddd4c6c47864c8453ceddbfa27933c4306d78f903080aa6222e43a4f8f
7
- data.tar.gz: ad2cf1d229a5a77594e6b2d697b14ded970659c1fb65cc01e4671a2b799bd17d8afc814ca6cc91510a97e7dbdab3926cb60fdcc82a1afb78ecd7a9aa695628d9
6
+ metadata.gz: bdb00333afc55d6de709d6f211859dee1e1c6ed04c7b535b32f1860f1fc2717293c68d3cf542dbfe36a26fb62c406d7a63de6f7296b50cebf2579984d3b3af1a
7
+ data.tar.gz: d6199e46bf54ba1907186f27478449ba6431ec26b346028acff456dc54ea78ef58c18e6281901b9f6e1224e1cda0250ac7c66879b3286ff38cea407f6673475c
@@ -540,15 +540,37 @@ module Tapioca
540
540
  Module.instance_method(:constants).bind(constant).call(false)
541
541
  end
542
542
 
543
+ sig { params(constant: Module).returns(T.nilable(String)) }
544
+ def raw_name_of(constant)
545
+ Module.instance_method(:name).bind(constant).call
546
+ end
547
+
543
548
  sig { params(constant: Module).returns(T.nilable(String)) }
544
549
  def name_of(constant)
545
- name = Module.instance_method(:name).bind(constant).call
550
+ name = name_of_proxy_target(constant)
551
+ return name if name
552
+ name = raw_name_of(constant)
546
553
  return if name.nil?
547
554
  return unless are_equal?(constant, resolve_constant(name))
548
555
  name = "Struct" if name =~ /^(::)?Struct::[^:]+$/
549
556
  name
550
557
  end
551
558
 
559
+ sig { params(constant: Module).returns(T.nilable(String)) }
560
+ def name_of_proxy_target(constant)
561
+ klass = class_of(constant)
562
+ return unless raw_name_of(klass) == "ActiveSupport::Deprecation::DeprecatedConstantProxy"
563
+ # We are dealing with a ActiveSupport::Deprecation::DeprecatedConstantProxy
564
+ # so try to get the name of the target class
565
+ begin
566
+ target = Kernel.instance_method(:send).bind(constant).call(:target)
567
+ rescue NoMethodError
568
+ return nil
569
+ end
570
+
571
+ name_of(target)
572
+ end
573
+
552
574
  sig { params(constant: Module).returns(T.nilable(String)) }
553
575
  def qualified_name_of(constant)
554
576
  name = name_of(constant)
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapioca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2019-07-15 00:00:00.000000000 Z
14
+ date: 2019-07-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pry