sequitur 0.0.07 → 0.0.08

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
- YjliZTY3NWVkYWRmNzI3ZmZmNDI2YWU5ZjY0NzUxZjg1ZWQ3ZTFmMg==
4
+ ODkxZDczYzdhYTJhMTk5NzU1MGUzNTZjZWEyZjNlODI5YzRhOGY2Yg==
5
5
  data.tar.gz: !binary |-
6
- Y2ZjNGYxNDk1NGYxMTE5NTBiYzkyOWYyMGRjYmUyNGMzMGE2MTUxZQ==
6
+ ZTA2NjA5ZGRhZDI4YjA3ZmJhOWQwNmM2ODMwYTFlZmYxOTcxMzYzNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NzBmZDFiMGQyNWFiNjMzMDAwYTM3ODQ0ZDk4YmUzMTNiYmNjNTE3MGU2ZWZl
10
- ZjNmNzdkYzgwOTZiZmZjYjM2NzVkNDIxODhlZDMwMjM1YjIxMDA5ZjhkMTU5
11
- ZGNkMDQwNDZkNDRmMWI4NWY2ZWIyMWQwYTAwZDZlZjNjOTVjNWQ=
9
+ MDJmMDQwYjMxYWI4YzhiZmRmM2IzMjM1ZGM0OGFiNzE0YzI0ZDRhNzNmNTM3
10
+ N2ExNzNhMTI0ODM3NzcwNDQxY2UxYjJhMzk1NmMwYTcyZDAyMzZkYzZkMDFk
11
+ MjgwYmQ0ZjdhOTJkNzcxMTRhNjJkYTE3ZTQyZDAzMDg5M2M3MzE=
12
12
  data.tar.gz: !binary |-
13
- ZDEzY2IyZDk5ZGMxMWY0ZDJiZGMxZDA2ZDM2MzcwNTRhNTRhYWEyODUxNDBl
14
- ZTE2OTUxOGM4ZDk4MTdlYmU0ZWI1NGM0ZTNlMWI5MTgzMzg3Y2FmMzhhNTU3
15
- ZmYxMTg3NGNkMDljZGQ3MzhmMmQyMWNkZWQ2NjFiYzhlZTlmNTY=
13
+ ODUwZjc1NDhlNWI1YmQyNjY0ODRlNmZhMTdmMTEzMGEyYzEyYjVmNjk2MWQy
14
+ MjlmMjQ2NjQ0NmJmZTcyNzM4OTUzMTgxZTE2YzkwOTY4ZGYwZTNmZjNiMmRm
15
+ MTk3NzRiNDA1NzJjOTAzNDFiOTI1NmZhZmJmZDRkODA2NThjOGY=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### 0.0.08 / 2014-08-24
2
+ * [CHANGE] `production_spec.rb`: Improved tests in order to reach 100% code coverage for the Production class.
3
+
1
4
  ### 0.0.07 / 2014-08-24
2
5
  * [CHANGE] `digram.rb`: Updated Digram class documentation.
3
6
 
@@ -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.0.07'
6
+ Version = '0.0.08'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = 'Ruby implementation of the Sequitur algorithm'
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Sequitur # Module for classes implementing the Sequitur algorithm
4
4
 
5
- # In linguitics, a digram is a sequence of two letters.
5
+ # In linguistics, a digram is a sequence of two letters.
6
6
  # In Sequitur a digram is a sequence of two consecutive symbols that
7
7
  # appear in a grammar (production) rule. Each symbol in a digram
8
8
  # can be a terminal or not.
@@ -35,7 +35,7 @@ class Production
35
35
  end
36
36
 
37
37
 
38
- # Return the set of productions appearing in the rhs
38
+ # Return the set of productions appearing in the rhs.
39
39
  def references()
40
40
  return rhs.select { |symb| symb.kind_of?(Production) }
41
41
  end
@@ -80,6 +80,8 @@ class Production
80
80
  end
81
81
 
82
82
  # Add a back reference to the given production.
83
+ # @param aProduction [Production] Assume that production P appears in the
84
+ # RHS of production Q, then a reference count of P is incremented in Q.
83
85
  def add_backref(aProduction)
84
86
  prod_id = aProduction.object_id
85
87
 
@@ -113,7 +115,7 @@ class Production
113
115
  case elem
114
116
  when String then "'#{elem}'"
115
117
  when Production then "#{elem.object_id}"
116
- else "#{elem}"
118
+ else elem.to_s
117
119
  end
118
120
  end
119
121
 
@@ -125,9 +125,10 @@ describe Production do
125
125
  end
126
126
 
127
127
  it 'should emit its text representation' do
128
- symbols = [:a, :b, 'c', :d, :e, :f]
128
+ instance = Production.new
129
+ symbols = [:a, :b, 'c', :d, :e, 1000, instance]
129
130
  symbols.each { |symb| subject.append_symbol(symb) }
130
- expectation = "#{subject.object_id} : a b 'c' d e f."
131
+ expectation = "#{subject.object_id} : a b 'c' d e 1000 #{instance.object_id}."
131
132
  expect(subject.to_string).to eq(expectation)
132
133
  end
133
134
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequitur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.07
4
+ version: 0.0.08
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef