dissociated_introspection 0.5.0 → 0.6.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
  SHA1:
3
- metadata.gz: caddb3eab986b9c628d086662b2694a3485f2bd0
4
- data.tar.gz: dba363070d4bcbf74c7a0ce03007ca885f009418
3
+ metadata.gz: 81959d2c8bc2c3dbb63e251f7fdd5009ee93f956
4
+ data.tar.gz: 562ba368f250d8760a81e37be0796e3bb7239897
5
5
  SHA512:
6
- metadata.gz: ac8d89c506185c591453feb85496a463f0697f1f1a042105c7a200a1be7373496145eae2c9384bcaac5c8ae88d03810376b6943afc9e88b80e6cc47b445f8797
7
- data.tar.gz: 45e2f7fed615fc9fda1fecf63eb8e1d48cdd6f94f2901999dc5b61162ca24a708b5da1ba7e8fa9d3a018ceed3ed9b60d72f09240c745dc72082057e79c2927df
6
+ metadata.gz: 292d0fc61d0f12c99330d8fb8c0d323d768ae4012744a73df32e90f7125ba99e7d741fa91014cac64f038d9741d476cb1eb8656f5bf3305023faef57d446eea7
7
+ data.tar.gz: f444ccfeb8cefee2f12950632ccd2bc8347a71d3f378f8e6f78f936816df001833e9f42b3e599d482283bfcc4e53cbeb7b22ce3d51acf7d0d8e687a51ca84ac8
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## 0.5 - 2016-04-30
4
+ ## 0.6.0 - 2016-09-08
5
+ ### Enhancement
6
+ - `DissociatedIntrospection::RubyClass#defs` now returns associated comments
7
+
8
+ ## 0.5.0 - 2016-04-30
5
9
  ### Enhancement
6
10
  - `DissociatedIntrospection.listen_to_defined_class_methods=` In addition to ruby methods like
7
11
  attr_reader other DSL class methods can be recorded if specified.
@@ -65,7 +65,12 @@ module DissociatedIntrospection
65
65
  end
66
66
 
67
67
  def defs
68
- class_begin.children.select { |n| n.try(:type) == :def }.map { |n| Def.new(ast: n) }
68
+ class_begin.children.select { |n| n.try(:type) == :def }.map do |n|
69
+ def_comments = comments.select do |comment|
70
+ comment.location.last_line+1 == n.location.first_line
71
+ end
72
+ Def.new(RubyCode.build_from_ast(n, comments: def_comments))
73
+ end
69
74
  end
70
75
 
71
76
  def class_begin
@@ -2,28 +2,28 @@ module DissociatedIntrospection
2
2
  class RubyClass
3
3
  class Def
4
4
 
5
- def initialize(ast:)
6
- @ast = ast
5
+ def initialize(ruby_code)
6
+ @ruby_code = ruby_code
7
7
  end
8
8
 
9
9
  def name
10
- ast.children[0]
10
+ ruby_code.ast.children[0]
11
11
  end
12
12
 
13
13
  def arguments
14
- Unparser.unparse(ast.children[1])
14
+ Unparser.unparse(ruby_code.ast.children[1])
15
15
  end
16
16
 
17
17
  def body
18
- Unparser.unparse(ast.children[2])
18
+ Unparser.unparse(ruby_code.ast.children[2])
19
19
  end
20
20
 
21
21
  def to_ruby_str
22
- Unparser.unparse(ast)
22
+ ruby_code.to_ruby_str
23
23
  end
24
24
 
25
25
  private
26
- attr_reader :ast
26
+ attr_reader :ruby_code
27
27
  end
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module DissociatedIntrospection
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-01 00:00:00.000000000 Z
11
+ date: 2016-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -136,3 +136,4 @@ specification_version: 4
136
136
  summary: Introspect methods, parameters, class macros, and constants without loading
137
137
  a parent class or any other dependencies.
138
138
  test_files: []
139
+ has_rdoc: