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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 359a8cd686aa1220c2bc0851a36a70d656de0967
4
- data.tar.gz: ac1f3a0a66b222abaec770b75e5257183f818a8a
3
+ metadata.gz: 713df3341f2c79b81034496b2845cc99ec213f9c
4
+ data.tar.gz: 0c144dbb4a4ff8964c4f5feeee4be48a4fbcd878
5
5
  SHA512:
6
- metadata.gz: 2f0c03e89a26fd323079a29ecfb6878735702f239e81b2df6f7db51822613b9f1590e4e7e5e96c6c97a5929ed01b5150bbf23333f562d897a042f25c626622f7
7
- data.tar.gz: 0b5884a20d62760a6d595108e23d17fc0282d04eba3fc5fff7b711985190554ea65e9f8fa2f28821b6975986b0c668d152c6bf9b1e00492acd49d1d1b7479a73
6
+ metadata.gz: e2bb6fd2b0893572c1b00150fad69f92bedacadc1bc97fc2413957823c76f7208e701acd1a0b244b17d84845497e0fe8cfea57657b466d0c13cacc195d7f5fc4
7
+ data.tar.gz: 69019538ede79b29ce12ac91879994b2ed0d8feec6ec6efcd4e401d64dfb3636c2b46876985e64f7f491c60c25c48dba639f842d9ee26f8d0294bea489e190f3
@@ -6,9 +6,12 @@ module Snuffle
6
6
  attr_accessor :element, :neighbors, :line_numbers
7
7
 
8
8
  def self.from(nodes)
9
- cohorts = Element::Hash.materialize(nodes.hashes.to_a).inject([]) do |cohorts, element|
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
- cohorts << cohort if cohort.values.count > 1 && cohort.near_neighbors.count > 0
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,
@@ -1,3 +1,3 @@
1
1
  module Snuffle
2
- VERSION = "0.11.1"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  require 'snuffle'
2
2
 
3
3
  def source_file
4
- @source_file ||= Snuffle::SourceFile.new(path_to_file: "spec/fixtures/latent_object_fixture.rb")
4
+ @source_file ||= Snuffle::SourceFile.new(path_to_file: "spec/fixtures/program_3.rb")
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snuffle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coraline Ada Ehmke