drg 0.15.1 → 0.15.2

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: 42a8cc2408820a2a4101af0d3c59c058562e83ed
4
- data.tar.gz: c956180e13fae9e3f0b00896a46d4bf60c160869
3
+ metadata.gz: f1910c0f8c2bc805658481b0fe924c81178d6523
4
+ data.tar.gz: 59a3de60bfcfa792a81cad5b23ba77cf569c259c
5
5
  SHA512:
6
- metadata.gz: 35e3b6994c4ab69cdc529a20caa30638fc7e004073ebb6b0d879addba16e3abc3ad1ee13d8bab395dd79c6eddaacd0b32cc006767df6059190794397c1050c37
7
- data.tar.gz: 2902a622ed22d2b0131ead991e46ab1f65a677f0fee21a4189b9fa1e8ae06f8783e50545591ed97b1ddbea8300d600ced7bd1b8a150ce21c6cfcfbd8849083cc
6
+ metadata.gz: e92fdb899f3ad0beba37ed43de71a7da699aaa0eb58496057f7632a1d3c1631479cac601f36a90423e61856e1ff30aa9e468d577ca0ef5699995b3b3cfb2449b
7
+ data.tar.gz: 46c3e353e3a89151609f7621e92b7cdd07a5ff89897f10d5e75b26cc360c133b4c07222d8c22f40db3ff5d75019ff74da52e79d5b2945d80174dafe843d90966
@@ -1,7 +1,8 @@
1
1
  require 'ruby_parser'
2
2
 
3
3
  class DRG::Ruby::Const
4
- CONSTANT_DEFS = { class: :class, module: :module, cdecl: :class }
4
+ CLASS_MOD_DEFS = { class: :class, module: :module }
5
+ CONSTANT_DEFS = { cdecl: :class }.merge CLASS_MOD_DEFS
5
6
 
6
7
  attr_reader :sexp
7
8
 
@@ -11,13 +12,19 @@ class DRG::Ruby::Const
11
12
  @sexp = sexp
12
13
  end
13
14
 
15
+ # s(:module, :Admin, s(:class, :Super, nil, s(:class, :UsersController, s(:colon3, :ApplicationController), s(:defn, :name, s(:args)
16
+ # s(:class, :Report, nil, s(:cdecl, :DEFAULT_TZ, s(:str, "UTC")), s(:defs, s(:self), :enqueue,
14
17
  def name(sexp = @sexp, list = [])
15
18
  sexp = Array(sexp)
16
19
  if sexp[1].is_a?(Sexp) && sexp[1][0] == :colon2
17
20
  parts = sexp[1].to_a.flatten
18
21
  list.concat parts.drop(parts.size / 2)
19
22
  elsif CONSTANT_DEFS.key?(sexp[0])
20
- name(sexp.compact[2], list << sexp[1].to_s)
23
+ list << sexp[1].to_s
24
+ # recurse unless the second element is nil, which indicates it's the end of the class/module definition
25
+ if !sexp[2].nil? || (sexp[3].is_a?(Sexp) and CLASS_MOD_DEFS.key?(sexp[3].first))
26
+ name(sexp.compact[2], list)
27
+ end
21
28
  end
22
29
  list.join('::')
23
30
  end
data/lib/drg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DRG
2
- VERSION = '0.15.1'.freeze
2
+ VERSION = '0.15.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Buckley