analyst 1.2.2 → 1.2.3

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: 937adcc8c7ba7aa34b7b475871d13700f46b501b
4
- data.tar.gz: 4f9c06b8de8d809a00f6458a713b51db7a1b6477
3
+ metadata.gz: 6ea5bd57c9b1d90428240940a4f84ced00e3f743
4
+ data.tar.gz: 7c681665591d6fe4fcbf600fc536f669da9899fa
5
5
  SHA512:
6
- metadata.gz: 35f4dd4b049068537a0fbf7564d199f79483406d6cad210c10e87c7a9c8c4d7dab93a79a935537cf8171f9f850d523c3a6c08a8368a73737f727340df6784e7a
7
- data.tar.gz: 02e7c98efa10989b735c66110bb9bacb12aec2a3ec09173b8cd53746bcc7b274c18c85ddc628785746c9ce6b71a557e67fe1cd1e89a2febfecc6390818ea40a6
6
+ metadata.gz: 46712d33f6615c99cefc252eec3c33b52956ad15ca78ee18ac30028c1f79d2033b1828f042fe6cdb44f5b5fdf691bb23a0c219a990603156b86b9f884e66cd59
7
+ data.tar.gz: adf555e1ec1e3c7124a08e02a0c2fb5e373c87ee652a98e7ee10d1bd5b7169c54e8fb999fb542801068596757a106f9e6785fe312ced1efd18373ce2261e520e
@@ -23,6 +23,8 @@ require_relative "analyst/entities/hash"
23
23
  require_relative "analyst/entities/pair"
24
24
  require_relative "analyst/entities/symbol"
25
25
  require_relative "analyst/entities/string"
26
+ require_relative "analyst/entities/variable_assignment"
27
+ require_relative "analyst/entities/lvar"
26
28
 
27
29
  module Analyst
28
30
 
@@ -0,0 +1,28 @@
1
+ module Analyst
2
+
3
+ module Entities
4
+ class Lvar < Entity
5
+
6
+ handles_node :lvar
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.first
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -16,6 +16,10 @@ module Analyst
16
16
  @arguments ||= process_nodes(ast.children[2..-1])
17
17
  end
18
18
 
19
+ def scope
20
+ @scope ||= process_node(ast.children.first)
21
+ end
22
+
19
23
  private
20
24
 
21
25
  def contents
@@ -17,10 +17,14 @@ module Analyst
17
17
  @scope ||= process_node(ast.children.first)
18
18
  end
19
19
 
20
+ def value
21
+ @value ||= process_nodes(ast.children)
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def name_node
23
- ast.children[1]
27
+ ast.children[1].children.first
24
28
  end
25
29
  end
26
30
  end
@@ -8,7 +8,7 @@ module Analyst
8
8
  :methods, :method_calls, :hashes, :variables
9
9
 
10
10
  def self.for_files(*path_to_files)
11
- file_paths = path_to_files.map do |path|
11
+ file_paths = path_to_files.flatten.map do |path|
12
12
  if File.directory?(path)
13
13
  Dir.glob(File.join(path, "**", "*.rb"))
14
14
  else
@@ -1,3 +1,3 @@
1
1
  module Analyst
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
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.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coraline Ada Ehmke
@@ -178,6 +178,7 @@ files:
178
178
  - lib/analyst/entities/entity.rb
179
179
  - lib/analyst/entities/hash.rb
180
180
  - lib/analyst/entities/interpolated_string.rb
181
+ - lib/analyst/entities/lvar.rb
181
182
  - lib/analyst/entities/method.rb
182
183
  - lib/analyst/entities/method_call.rb
183
184
  - lib/analyst/entities/mixins/has_methods.rb