dissociated_introspection 0.8.2 → 0.8.3

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
  SHA1:
3
- metadata.gz: 1aeb8030289497e9c1b77b5b610b98e258c97726
4
- data.tar.gz: 0c273e85a72300be0d186bab5b48380945a28163
3
+ metadata.gz: 1347c997f6859c2f72aa56dacd8f8b1224af775e
4
+ data.tar.gz: 2d4b307d2331aac56f84dfbffc1aeb97a8e12cc6
5
5
  SHA512:
6
- metadata.gz: c080d180400554d562caeba5ac0dc70cf5d098794d60b997828ae33c24afc457bf18cf104c37b9ff97d6d0199051531b2f92d806490222b235fd09e108f68017
7
- data.tar.gz: ad5c85a1fdc15202740c55dced7f6ea1b24a9207e41c365594da2710473004added33990b15548b7dfafeb81ba111f160ef17a71bb3b0b0658ee736f8a7563cc
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.has_key?(:source)
9
- RubyCode.build_from_source(ruby_code[:source], parse_with_comments: ruby_code[:parse_with_comments])
10
- elsif ruby_code.is_a?(Hash) && ruby_code.has_key?(:ast)
11
- RubyCode.build_from_ast(ruby_code[:ast],
12
- comments: ruby_code.fetch(:comments, []))
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| [:defs, :sclass].include? n.try(:type) }.map do |n|
64
- new_n = if n.type == :defs # def self.method;end
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)
@@ -1,3 +1,3 @@
1
1
  module DissociatedIntrospection
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
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.8.2
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-06-23 00:00:00.000000000 Z
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.2.5
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: