dissociated_introspection 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/dissociated_introspection/ruby_class.rb +16 -13
- data/lib/dissociated_introspection/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1347c997f6859c2f72aa56dacd8f8b1224af775e
|
4
|
+
data.tar.gz: 2d4b307d2331aac56f84dfbffc1aeb97a8e12cc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af117399720c5372560be8db9d35510e7c0fa445b34828cc234d270ac4cb1dd9cead23f9f4a94c74a445915eab6b7f72fa5ec759d76405a4319a6e0a04014fd
|
7
|
+
data.tar.gz: f001e0be1a84a1e24ccc46e162c8a34b46836105e12355f116ae04fb132f4aef710ea3625589b727d8905f51c6ca4d28497c0932e04d9e61681734a756c16545
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 0.8.3 - 2017-09-30
|
5
|
+
### Fix
|
6
|
+
- DissociatedIntrospection::RubyClass#class_defs failed to parse class methods with `class >> self; end;`
|
7
|
+
|
8
|
+
## 0.8.2 - 2017-06-23
|
9
|
+
### Enhancement
|
10
|
+
- Less strict parser version
|
11
|
+
|
12
|
+
## 0.8.1 - 2017-03-24
|
13
|
+
### Enhancement
|
14
|
+
- inspect_methods takes :instance_methods or :class_method/:methods to access #defs #class_defs
|
15
|
+
|
4
16
|
## 0.8.0 - 2017-03-24
|
5
17
|
### Enhancement
|
6
18
|
- DissociatedIntrospection::RubyClass#class_defs returns same api as #defs
|
@@ -5,11 +5,16 @@ module DissociatedIntrospection
|
|
5
5
|
using Try
|
6
6
|
|
7
7
|
def initialize(ruby_code)
|
8
|
-
@ruby_code = if ruby_code.is_a?(Hash) && ruby_code.
|
9
|
-
RubyCode.build_from_source(
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
@ruby_code = if ruby_code.is_a?(Hash) && ruby_code.key?(:source)
|
9
|
+
RubyCode.build_from_source(
|
10
|
+
ruby_code[:source],
|
11
|
+
parse_with_comments: ruby_code[:parse_with_comments]
|
12
|
+
)
|
13
|
+
elsif ruby_code.is_a?(Hash) && ruby_code.key?(:ast)
|
14
|
+
RubyCode.build_from_ast(
|
15
|
+
ruby_code[:ast],
|
16
|
+
comments: ruby_code.fetch(:comments, [])
|
17
|
+
)
|
13
18
|
else
|
14
19
|
ruby_code
|
15
20
|
end
|
@@ -60,15 +65,13 @@ module DissociatedIntrospection
|
|
60
65
|
end
|
61
66
|
|
62
67
|
def class_defs
|
63
|
-
class_begin.children.select { |n|
|
64
|
-
|
65
|
-
n.updated(:def, n.children[1..-1])
|
66
|
-
elsif n.type == :sclass # class >> self; def method;end
|
67
|
-
n.updated(:def, n.children[1].children, location: n.children[1].location)
|
68
|
-
end
|
69
|
-
|
70
|
-
create_def(new_n)
|
68
|
+
ns = class_begin.children.select { |n| :defs == n.try(:type) }.map do |n|
|
69
|
+
create_def(n.updated(:def, n.children[1..-1]))
|
71
70
|
end
|
71
|
+
ns2 = class_begin.children.select { |n| :sclass == n.try(:type) }.flat_map do |n|
|
72
|
+
n.children[1].children.select { |n| n.try(:type) == :def }.map(&method(:create_def))
|
73
|
+
end
|
74
|
+
[*ns, *ns2]
|
72
75
|
end
|
73
76
|
|
74
77
|
def inspect_methods(type=:instance_methods)
|
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.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -132,10 +132,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.6.11
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Introspect methods, parameters, class macros, and constants without loading
|
139
139
|
a parent class or any other dependencies.
|
140
140
|
test_files: []
|
141
|
-
has_rdoc:
|