analyst 1.2.1 → 1.2.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: fe9cc2256a78d1b641b3acc989248e6ac487153f
4
- data.tar.gz: ab0637232b62d380f4f358daeae1806b365204cd
3
+ metadata.gz: 937adcc8c7ba7aa34b7b475871d13700f46b501b
4
+ data.tar.gz: 4f9c06b8de8d809a00f6458a713b51db7a1b6477
5
5
  SHA512:
6
- metadata.gz: f7cc7067e0aa0dd8d95e202a0463d12b1f511cfab1457aa095b28e6e190a16c64fd64c9c9d00226859c1dceac9fe8a9bef950c3935489919418124dd79d01331
7
- data.tar.gz: 8f188afbe86a535af8d6454b164f6636e3eab6d74715b5258ca3b82ed9898f3dab4d16cf66c1de86b5e30cc0cb740dbcfe5c7b7ce3e77620b0bd6c15940b3bb5
6
+ metadata.gz: 35f4dd4b049068537a0fbf7564d199f79483406d6cad210c10e87c7a9c8c4d7dab93a79a935537cf8171f9f850d523c3a6c08a8368a73737f727340df6784e7a
7
+ data.tar.gz: 02e7c98efa10989b735c66110bb9bacb12aec2a3ec09173b8cd53746bcc7b274c18c85ddc628785746c9ce6b71a557e67fe1cd1e89a2febfecc6390818ea40a6
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["coraline@idolhands.com", "mikezx@gmail.com"]
11
11
  spec.summary = %q{A nice API for interacting with parsed Ruby source code.}
12
12
  spec.description = %q{A nice API for interacting with parsed Ruby source code.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://gitlab.com/coraline/analyst"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -78,6 +78,10 @@ module Analyst
78
78
  @conditionals ||= contents_of_type(Entities::Conditional)
79
79
  end
80
80
 
81
+ def variables
82
+ @variables ||= contents_of_type(Entities::VariableAssignment)
83
+ end
84
+
81
85
  def hashes
82
86
  @hashes ||= contents_of_type(Entities::Hash)
83
87
  end
@@ -0,0 +1,28 @@
1
+ module Analyst
2
+
3
+ module Entities
4
+ class VariableAssignment < Entity
5
+
6
+ handles_node :lvasgn
7
+
8
+ def name
9
+ name_node.to_s
10
+ end
11
+
12
+ def full_name
13
+ (scope.nil? ? parent.full_name : scope.full_name) + '::' + name
14
+ end
15
+
16
+ def scope
17
+ @scope ||= process_node(ast.children.first)
18
+ end
19
+
20
+ private
21
+
22
+ def name_node
23
+ ast.children[1]
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -5,7 +5,7 @@ module Analyst
5
5
  extend Forwardable
6
6
 
7
7
  def_delegators :root, :classes, :top_level_classes, :constants, :modules,
8
- :methods, :method_calls, :hashes
8
+ :methods, :method_calls, :hashes, :variables
9
9
 
10
10
  def self.for_files(*path_to_files)
11
11
  file_paths = path_to_files.map do |path|
@@ -1,3 +1,3 @@
1
1
  module Analyst
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analyst
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coraline Ada Ehmke
@@ -188,6 +188,7 @@ files:
188
188
  - lib/analyst/entities/string.rb
189
189
  - lib/analyst/entities/symbol.rb
190
190
  - lib/analyst/entities/unhandled.rb
191
+ - lib/analyst/entities/variable_assignment.rb
191
192
  - lib/analyst/parser.rb
192
193
  - lib/analyst/processor.rb
193
194
  - lib/analyst/version.rb
@@ -207,7 +208,7 @@ files:
207
208
  - spec/fixtures/syntax_errors/good.rb
208
209
  - spec/parser_spec.rb
209
210
  - spec/spec_helper.rb
210
- homepage: ''
211
+ homepage: https://gitlab.com/coraline/analyst
211
212
  licenses:
212
213
  - MIT
213
214
  metadata: {}