analyst 0.14.1 → 0.14.2

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: 11e1dd216d49997bb7f575af62708044f3ca2fab
4
- data.tar.gz: 010b6c3403da2a75375f5b41510e206714ca5111
3
+ metadata.gz: 2741a5ba1447921d472b3a13e573b8d35bf1d39c
4
+ data.tar.gz: 6db0b7297d497d41d406c2b67cf1d760cb751d76
5
5
  SHA512:
6
- metadata.gz: 702d6627269aa6c71789b54c9fec5600b0c4cdd36ac7abaef5b88f243df1dbbfb29e0029d50e550789ca5f356752e2d489eb9dc86b0fb42419095bf215912fca
7
- data.tar.gz: 9e52aa70e137e31dc19c84d3784d92fd88b4a1d34cbae485eefad11d08b3743db35d9b04b3cb71d80d8d448f234f5e89c540a0fb2d9aeb0f6c05f90b618a0225
6
+ metadata.gz: 5d4f07efff500a960139db14696b1d35bd85321ee83f0f178a708d20fa80ca4ec1c5c49b9e83d41d30611d9610aacc3743924737d410ec875e5103ec5c31b667
7
+ data.tar.gz: b18f69c1fa2cfc2357ef97c3ad6ee0685e6a1395d333dfceefc1fdbb76751b29ec624e20c4411e277e176945dabc95f7183de3de6c60df89945a02fce0aa3129
@@ -10,9 +10,14 @@ require_relative "analyst/entities/root"
10
10
  require_relative "analyst/entities/begin"
11
11
  require_relative "analyst/entities/module"
12
12
  require_relative "analyst/entities/class"
13
+ require_relative "analyst/entities/interpolated_string"
13
14
  require_relative "analyst/entities/method"
14
15
  require_relative "analyst/entities/method_call"
15
16
  require_relative "analyst/entities/singleton_class"
17
+ require_relative "analyst/entities/hash"
18
+ require_relative "analyst/entities/pair"
19
+ require_relative "analyst/entities/symbol"
20
+ require_relative "analyst/entities/string"
16
21
  require_relative "analyst/parser"
17
22
  require_relative "analyst/version"
18
23
 
@@ -62,6 +62,13 @@ module Analyst
62
62
  ast.children.last
63
63
  end
64
64
 
65
+ def process_node(node, parent=self)
66
+ Analyst::Parser.process_node(node, parent) }
67
+ end
68
+
69
+ def process_nodes(nodes, parent=self)
70
+ nodes.map { |node| process_node(node, parent) }
71
+ end
65
72
  end
66
73
  end
67
74
  end
@@ -0,0 +1,17 @@
1
+ module Analyst
2
+
3
+ module Entities
4
+ class Hash < Entity
5
+ def pairs
6
+ @pairs ||= process_nodes(ast.children)
7
+ end
8
+
9
+ def to_hash
10
+ @pairs.inject({}) do |hash, pair|
11
+ hash[pair.key] = pair.value
12
+ hash
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ module Analyst
2
+ module Entities
3
+
4
+ class InterpolatedString < Entity
5
+ def name
6
+ throw "Needs implementation"
7
+ end
8
+
9
+ def full_name
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -10,6 +10,13 @@ module Analyst
10
10
  name
11
11
  end
12
12
 
13
+ def arguments
14
+ @arguments ||= begin
15
+ args = ast.children[2..-1]
16
+ args.map { |arg| Analyst::Parser.process_node(arg, self) }
17
+ end
18
+ end
19
+
13
20
  # TODO: figure out how to resolve this to an Entity. we never want
14
21
  # to expose the AST to the outside.
15
22
  def target_node
@@ -0,0 +1,14 @@
1
+ module Analyst
2
+
3
+ module Entities
4
+ class Pair < Entity
5
+ def key
6
+ process_node(ast.children[0])
7
+ end
8
+
9
+ def value
10
+ process_node(ast.children[1])
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module Analyst
2
+
3
+ module Entities
4
+ module String
5
+
6
+ def self.new(node, parent)
7
+ ast.children.first
8
+ end
9
+
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,13 @@
1
+ module Analyst
2
+
3
+ module Entities
4
+ module Symbol
5
+
6
+ def self.new(node, parent)
7
+ ast.children.first
8
+ end
9
+
10
+ end
11
+ end
12
+ end
13
+
@@ -20,7 +20,8 @@ module Analyst
20
20
  :begin => Entities::Begin,
21
21
  :module => Entities::Module,
22
22
  :send => Entities::MethodCall,
23
- :sclass => Entities::SingletonClass
23
+ :sclass => Entities::SingletonClass,
24
+ :dstr => Entities::InterpolatedString
24
25
  # :def => :method_node_parser,
25
26
  # :send => :send_node_parser
26
27
  # TODO: make a method parser, which pushes the the context_stack so that things inside method bodies
@@ -1,3 +1,3 @@
1
1
  module Analyst
2
- VERSION = "0.14.1"
2
+ VERSION = "0.14.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: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coraline Ada Ehmke
@@ -216,11 +216,16 @@ files:
216
216
  - lib/analyst/entities/class.rb
217
217
  - lib/analyst/entities/empty.rb
218
218
  - lib/analyst/entities/entity.rb
219
+ - lib/analyst/entities/hash.rb
220
+ - lib/analyst/entities/interpolated_string.rb
219
221
  - lib/analyst/entities/method.rb
220
222
  - lib/analyst/entities/method_call.rb
221
223
  - lib/analyst/entities/module.rb
224
+ - lib/analyst/entities/pair.rb
222
225
  - lib/analyst/entities/root.rb
223
226
  - lib/analyst/entities/singleton_class.rb
227
+ - lib/analyst/entities/string.rb
228
+ - lib/analyst/entities/symbol.rb
224
229
  - lib/analyst/parser.rb
225
230
  - lib/analyst/version.rb
226
231
  - spec/class_spec.rb