snuffle 0.11.1 → 0.12.0
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 +4 -4
- data/lib/snuffle/cohort.rb +5 -2
- data/lib/snuffle/latent_object.rb +2 -2
- data/lib/snuffle/node.rb +9 -0
- data/lib/snuffle/version.rb +1 -1
- data/spec/fixtures/program_3.rb +8 -0
- data/test.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 713df3341f2c79b81034496b2845cc99ec213f9c
|
4
|
+
data.tar.gz: 0c144dbb4a4ff8964c4f5feeee4be48a4fbcd878
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2bb6fd2b0893572c1b00150fad69f92bedacadc1bc97fc2413957823c76f7208e701acd1a0b244b17d84845497e0fe8cfea57657b466d0c13cacc195d7f5fc4
|
7
|
+
data.tar.gz: 69019538ede79b29ce12ac91879994b2ed0d8feec6ec6efcd4e401d64dfb3636c2b46876985e64f7f491c60c25c48dba639f842d9ee26f8d0294bea489e190f3
|
data/lib/snuffle/cohort.rb
CHANGED
@@ -6,9 +6,12 @@ module Snuffle
|
|
6
6
|
attr_accessor :element, :neighbors, :line_numbers
|
7
7
|
|
8
8
|
def self.from(nodes)
|
9
|
-
|
9
|
+
nodes = nodes.non_sends.hashes
|
10
|
+
cohorts = Element::Hash.materialize(nodes.to_a).inject([]) do |cohorts, element|
|
10
11
|
cohort = Cohort.new(element: element, line_numbers: element.node.line_numbers )
|
11
|
-
|
12
|
+
if cohort.values.count > 1 && cohort.near_neighbors.count > 0
|
13
|
+
cohorts << cohort
|
14
|
+
end
|
12
15
|
cohorts
|
13
16
|
end
|
14
17
|
end
|
@@ -8,8 +8,8 @@ class Snuffle::LatentObject
|
|
8
8
|
STOPWORDS = [
|
9
9
|
"the", "be", "to", "of", "and", "a", "in", "that", "have", "I", "it", "for",
|
10
10
|
"not", "on", "with", "he", "as", "you", "do", "at", "this", "but", "his",
|
11
|
-
"by", "from", "they", "we", "say", "her", "she", "or", "an", "will", "my",
|
12
|
-
"one", "all", "would", "there", "their", "what", "so", "up", "out", "if",
|
11
|
+
"by", "from", "they", "we", "say", "her", "she", "or", "an", "will", "my", "are",
|
12
|
+
"one", "all", "would", "there", "their", "what", "so", "up", "out", "if", "is",
|
13
13
|
"about", "who", "get", "which", "go", "me", "when", "make", "can", "like",
|
14
14
|
"time", "no", "just", "him", "know", "take", "into", "else", "other", "again",
|
15
15
|
"your", "good", "some", "could", "them", "see", "other", "than", "then",
|
data/lib/snuffle/node.rb
CHANGED
@@ -12,11 +12,16 @@ module Snuffle
|
|
12
12
|
scope :with_parent, lambda{|parent_id| where(parent_id: parent_id) }
|
13
13
|
scope :hashes, {type: :hash}
|
14
14
|
scope :methods, {is_method: true}
|
15
|
+
scope :non_sends, {is_send: false}
|
15
16
|
|
16
17
|
def self.nil
|
17
18
|
new(type: :nil)
|
18
19
|
end
|
19
20
|
|
21
|
+
def self.not_a(type)
|
22
|
+
select{|node| node.type != type}
|
23
|
+
end
|
24
|
+
|
20
25
|
def initialize(*args, &block)
|
21
26
|
@id = SecureRandom.uuid
|
22
27
|
super
|
@@ -38,6 +43,10 @@ module Snuffle
|
|
38
43
|
self.type == :def || self.type == :defs
|
39
44
|
end
|
40
45
|
|
46
|
+
def is_send
|
47
|
+
self.type == :send
|
48
|
+
end
|
49
|
+
|
41
50
|
def inspect
|
42
51
|
{
|
43
52
|
id: self.id,
|
data/lib/snuffle/version.rb
CHANGED
data/spec/fixtures/program_3.rb
CHANGED
@@ -4,9 +4,17 @@ class Customer
|
|
4
4
|
attr_accessor :customer_id, :customer_name, :company_name
|
5
5
|
attr_accessor :street_address_1, :street_address_2
|
6
6
|
attr_accessor :city, :state, :postal_code
|
7
|
+
attr_accessor :fred
|
7
8
|
|
8
9
|
MY_CONSTANT = "TheOtherZachIsThePrimaryZach"
|
9
10
|
|
11
|
+
def who_is_fred
|
12
|
+
{
|
13
|
+
:status => 'friend',
|
14
|
+
:name => self.fred
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
10
18
|
def my_condition
|
11
19
|
puts "MAGIC" if true == false
|
12
20
|
end
|
data/test.rb
CHANGED