dissociated_introspection 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 4132b5ad0c5655e9caa5db59a8bc9ba45491b17d
4
- data.tar.gz: c51638262fdd7f96ee519735a3a325f4c05af8af
3
+ metadata.gz: c622b1363c06fc73f8ef83a3645180ba81a4ff54
4
+ data.tar.gz: 4880afc33b55e68835300cb782a6d69d09293418
5
5
  SHA512:
6
- metadata.gz: 2d49c20e5ccb107ceb57ee9834307d7075159ff02f4e83d87f2dda3c5630b624f76dcf2d2d42bc6be7605b180070823adc2de20e471b646bb5511a88d1de1b6b
7
- data.tar.gz: 7907ee3d1c8f6b9703ffbe0753cfbb7b13b6c7d49e6edd14d933a32220dd15e6da11c1331c80e3d80312c9b60d5d9ef037622be6818babfd2a9cf23cbd858f6c
6
+ metadata.gz: 98abb12259e2c5fd7ac436269ff3f37bbd585e7e30d0fa8c42224e40ee7cf1a57e9d842e19f406ff5fef62e2c371baf7717a17c61a7ca4bd1b92d090f04fc744
7
+ data.tar.gz: 84ae96f322ec2e815ec1000f4abbb3275f31cbe0ada14266cc1f2a912ee225b131ec3bcfb2091022de11606da84c3bc751bac9c61e98607c2516c8f31790ddc7
@@ -45,7 +45,7 @@ module DissociatedIntrospection
45
45
  def locally_defined_constants(type=nil)
46
46
  consts = get_class.constants - get_class.__missing_constants__.keys - [:BasicObject]
47
47
  return consts unless type
48
- consts.select{ |c| get_class.const_get(c).is_a?(type)}
48
+ consts.select { |c| get_class.const_get(c).is_a?(type) }
49
49
  end
50
50
 
51
51
  # @return [DissociatedIntrospection::RubyClass]
@@ -61,10 +61,13 @@ module DissociatedIntrospection
61
61
  private
62
62
 
63
63
  def add_method_name_wo_parent(_module)
64
- def _module.referenced_name
64
+ _class_name_ = parsed_source.class_name
65
+
66
+ _module.define_singleton_method(:referenced_name) do
65
67
  n = name.split("::")
66
- return n[2..-1].join("::") if n.first =~ /#<Module:.*>/
67
- return n[1..-1].join("::")
68
+ n = n.drop(1) if n.first =~ /#<Module:.*>/
69
+ n = n.drop(1) if n.first == _class_name_
70
+ return n.join("::")
68
71
  end
69
72
  _module
70
73
  end
@@ -75,11 +78,11 @@ module DissociatedIntrospection
75
78
 
76
79
  def _get_class
77
80
  modified_class_source = parsed_source.modify_parent_class(parent_class_replacement)
78
- path = if file.is_a? Pathname
79
- file.to_s
80
- else
81
- file.path
82
- end
81
+ path = if file.is_a? Pathname
82
+ file.to_s
83
+ else
84
+ file.path
85
+ end
83
86
  load_sandbox(OpenStruct.new(read: modified_class_source.to_ruby_str, path: path))
84
87
  end
85
88
 
@@ -1,3 +1,3 @@
1
1
  module DissociatedIntrospection
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dissociated_introspection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-22 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser