sequitur 0.1.14 → 0.1.15

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTYxNDJlM2U5ZWQ1YTk3OGQzOTYyODhjMWNmMDU1ZWQwYzZjNTY0Yg==
4
+ ODUxYjgzNjcxM2M5ZWQxZDgxNmE0NjJiM2E5Njc5MzBlY2Q1NDc2Mg==
5
5
  data.tar.gz: !binary |-
6
- NmFiMDlmY2E4YjMzYjFkNTRhNzY2M2M0NTdjNTRkM2QxYzE1ZGJkOA==
6
+ MjRjY2Q2MmRmOWEyZGE2NDI1NWQ2ZDJhZjdlMjE5YzdiMDhkOWI4YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDYxMGQ1NmRjNWQ5M2MwODBhZjliNmJhZTQ5ZWMwMmI1NzA1NTEwNjhiNmYx
10
- ZmYxYjg1NDMzMmE5NzJhNjY2OTQyMjUyMDhlYzU0Y2Y0NmQzYWU3ZTUxMjYw
11
- ZDc4NzE0MTEwZmQzMTRhNDZiM2VmMGI2NDk5ZjM4YmJjNDdhMDc=
9
+ NDI0YzNmOWI4ZTBlZGNjNDkxNmNmNTRhNDJjZDMzMDY4OWE4YmU5YmRjZmJl
10
+ NzI5MjViMjhhNGYyODkyNGQzNGMyMGFhMjRkNjMyMDBlOTFlN2ZhNzgzYzk1
11
+ MTgxNjYzYTA4YmFkZWE1ZDlmOTc0MDdkMzJmOGQzMTFiYmEzYWQ=
12
12
  data.tar.gz: !binary |-
13
- NzEwYzcwOTI4NWUyYTNjZmE3MDkyNjcxYWM2MDJkYjkzYWI1YWE3YmRhZjg4
14
- YzAxMTQ0NWM1ZTRmNzFhNjZiZTUyYTIzODE3ODY4ZGJhMGQzMmY1MmEzZTI0
15
- MWYwMDlkYmMzMzNhYTRkNGQzOGU5YmI5ZWM1OWNmMTQ3NjgxYzI=
13
+ OGI1NWI4NDBlMjhhYzQ3NWUyNDI1MmFkZmI0ZTgzYWRlZWQ1OTZlZWM4Yzg1
14
+ OTIxMDc4Zjc2NmY1MDExNzQ5OWYyZTkwY2EyZjgwMTczZGFkOGE2YzJkMjAx
15
+ NGQxMWY2NDBkOTBlNTM1M2I2YWNiNDA1M2U1MjZlMWFjY2RjZTI=
data/.rubocop.yml CHANGED
@@ -11,7 +11,10 @@ AbcSize:
11
11
  # This is disabled because some demos use UTF-8
12
12
  AsciiComments:
13
13
  Enabled: false
14
-
14
+
15
+ Attr:
16
+ Enabled: false
17
+
15
18
  CaseIndentation:
16
19
  IndentWhenRelativeTo: end
17
20
  IndentOneStep: true
@@ -52,6 +55,10 @@ MethodLength:
52
55
  Max: 50
53
56
  CountComments: false
54
57
 
58
+ # Avoid modules longer than 400 lines of code
59
+ ModuleLength:
60
+ Max: 400
61
+
55
62
  NonNilCheck:
56
63
  Enabled: false
57
64
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.1.15 / 2015-06-16
2
+ * [CHANGE] Code re-formatted to please Rubocop 0.32.0
3
+ * [FIX] File `.rubocop.yml`: change some cop settings.
4
+
1
5
  ### 0.1.14 / 2015-02-06
2
6
  * [CHANGE] Code re-formatted to please Rubocop 0.29
3
7
  * [FIX] File `.rubocop.yml`: removal of setting for obsolete EmptyLinesAroundBody cop.
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Sequitur # Module used as a namespace
5
5
  # The version number of the gem.
6
- Version = '0.1.14'
6
+ Version = '0.1.15'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = 'Ruby implementation of the Sequitur algorithm'
@@ -208,7 +208,7 @@ class Production
208
208
  # p_A.derive_step(p_B)
209
209
  # #Modifies p_A as into: p_A -> a x y b x y c
210
210
  def derive_step(another)
211
- (0...rhs.size).to_a.reverse.each do |index|
211
+ (0...rhs.size).to_a.reverse_each do |index|
212
212
  next unless rhs[index] == another
213
213
 
214
214
  rhs.insert_at(index + 1, another.rhs)
@@ -111,9 +111,8 @@ class SequiturGrammar < DynamicGrammar
111
111
  # Return a production that is used less than twice in the grammar.
112
112
  def detect_useless_production()
113
113
  useless = productions.index { |prod| prod.refcount < 2 }
114
- unless useless.nil?
115
- useless = nil if useless == 0
116
- end
114
+ useless = nil if useless && useless == 0
115
+
117
116
  return useless
118
117
  end
119
118
 
@@ -126,7 +125,7 @@ class SequiturGrammar < DynamicGrammar
126
125
 
127
126
  # Retrieve production referencing useless one
128
127
  referencing = nil
129
- productions.reverse.each do |a_prod|
128
+ productions.reverse_each do |a_prod|
130
129
  # Next line assumes non-recursive productions
131
130
  next if a_prod == useless_prod
132
131
 
@@ -31,7 +31,8 @@ describe SymbolSequence do
31
31
  it 'should deep-copy clone itself' do
32
32
  ref = ProductionRef.new(a_prod)
33
33
 
34
- a, c = 'a', 'c'
34
+ a = 'a'
35
+ c = 'c'
35
36
  [a, ref, c].each { |ch| instance << ch }
36
37
  clone_a = instance.clone
37
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequitur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-06 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake