employ_me 0.0.3 → 0.0.4
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4346c4379f4120da39b6e2e0998de13d941ed0aa475ef86b94c27fcb551a736e
|
|
4
|
+
data.tar.gz: 64a712333b97dbb6b782e443ad8ed64eb0cccaa2f1ccfc52900528194d20934c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a825a154b544a483a34dacd641161ee8a253394c94c0083575f55d8cb6c9161ba6353fe7380e5f500b18b07d135cc5a2d9988029b402e35f19ba72295ba0b663
|
|
7
|
+
data.tar.gz: 790b7854de9a3fbb3c643c16ab27eb7a07602f2e0499848967ef5a4fdf4f25ced68bcb5e1a7c1fc840c5b4baa032c672280db1a9ef8095556fbb74413bfe9a69
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module EmployMe
|
|
2
|
+
module Parser
|
|
3
|
+
module ProgrammingLanguage
|
|
4
|
+
module Strategies
|
|
5
|
+
class PatternMatch
|
|
6
|
+
# Return [programming language name]
|
|
7
|
+
def self.perform(root_node)
|
|
8
|
+
tree = [root_node]
|
|
9
|
+
|
|
10
|
+
# Depth First Search
|
|
11
|
+
while tree.size > 0
|
|
12
|
+
curr_node = tree.shift
|
|
13
|
+
|
|
14
|
+
if curr_node.children.all? { |child| child.name == "comment" || child.name == 'text' }
|
|
15
|
+
curr_node_text = curr_node.text
|
|
16
|
+
|
|
17
|
+
# C#
|
|
18
|
+
regex = Regexp.new('C#', Regexp::IGNORECASE)
|
|
19
|
+
return 'c_sharp' if regex.match(curr_node_text)
|
|
20
|
+
|
|
21
|
+
# Go
|
|
22
|
+
regex = Regexp.new('Go', Regexp::IGNORECASE)
|
|
23
|
+
return 'go' if regex.match(curr_node_text)
|
|
24
|
+
|
|
25
|
+
# Java
|
|
26
|
+
regex = Regexp.new('Java', Regexp::IGNORECASE)
|
|
27
|
+
return 'java' if regex.match(curr_node_text)
|
|
28
|
+
|
|
29
|
+
# Javascript
|
|
30
|
+
regex = Regexp.new('Node', Regexp::IGNORECASE)
|
|
31
|
+
return 'javascript' if regex.match(curr_node_text)
|
|
32
|
+
|
|
33
|
+
regex = Regexp.new('React', Regexp::IGNORECASE)
|
|
34
|
+
return 'javascript' if regex.match(curr_node_text)
|
|
35
|
+
|
|
36
|
+
regex = Regexp.new('Typescript', Regexp::IGNORECASE)
|
|
37
|
+
return 'javascript' if regex.match(curr_node_text)
|
|
38
|
+
|
|
39
|
+
# Kotlin
|
|
40
|
+
regex = Regexp.new('Kotlin', Regexp::IGNORECASE)
|
|
41
|
+
return 'kotlin' if regex.match(curr_node_text)
|
|
42
|
+
|
|
43
|
+
# Python
|
|
44
|
+
regex = Regexp.new('Python', Regexp::IGNORECASE)
|
|
45
|
+
return 'python' if regex.match(curr_node_text)
|
|
46
|
+
|
|
47
|
+
# Ruby
|
|
48
|
+
regex = Regexp.new('Ruby', Regexp::IGNORECASE)
|
|
49
|
+
return 'ruby' if regex.match(curr_node_text)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
tree.concat(curr_node.children)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
nil
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/employ_me.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: employ_me
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dgonzdev
|
|
@@ -31,6 +31,7 @@ extensions: []
|
|
|
31
31
|
extra_rdoc_files: []
|
|
32
32
|
files:
|
|
33
33
|
- lib/employ_me.rb
|
|
34
|
+
- lib/employ_me/parser/programming_language/strategies/pattern_match.rb
|
|
34
35
|
- lib/employ_me/parser/title/strategies/pattern_match.rb
|
|
35
36
|
homepage: https://rubygems.org/gems/employ_me
|
|
36
37
|
licenses: []
|