vector_embed 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/lib/vector_embed/maker/number.rb +1 -1
- data/lib/vector_embed/version.rb +1 -1
- data/spec/vector_embed_spec.rb +36 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/vector_embed/version.rb
CHANGED
data/spec/vector_embed_spec.rb
CHANGED
@@ -30,6 +30,25 @@ describe VectorEmbed do
|
|
30
30
|
v.line(true)
|
31
31
|
lambda { v.line(5.4) }.should raise_error(/Can't embed.*boolean/)
|
32
32
|
end
|
33
|
+
|
34
|
+
it "stores nil as 0 in number" do
|
35
|
+
v = VectorEmbed.new
|
36
|
+
v.line(1)
|
37
|
+
v.line(nil).should == '0'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "doesn't let you store nil in boolean" do
|
41
|
+
v = VectorEmbed.new
|
42
|
+
v.line(true)
|
43
|
+
lambda { v.line(nil) }.should raise_error(/Can't embed.*boolean/)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "treats nil as evidence of number" do
|
47
|
+
v = VectorEmbed.new
|
48
|
+
v.line(nil).should == '0'
|
49
|
+
v.line(1).should == '1'
|
50
|
+
end
|
51
|
+
|
33
52
|
end
|
34
53
|
|
35
54
|
describe 'using a dictionary' do
|
@@ -170,6 +189,23 @@ describe VectorEmbed do
|
|
170
189
|
v.line(3, 1 => '0').should == "3"
|
171
190
|
end
|
172
191
|
|
192
|
+
it "DOES output blank strings in phrase attributes" do
|
193
|
+
v = VectorEmbed.new
|
194
|
+
v.line(3, 5 => 'hello').should == "3 #{l_h("5\x00hello")}:1"
|
195
|
+
v.line(3, 5 => nil).should == "3 #{l_h("5\x00")}:1"
|
196
|
+
v.line(3, 5 => '').should == "3 #{l_h("5\x00")}:1"
|
197
|
+
v.line(3, 5 => ' ').should == "3 #{l_h("5\x00")}:1"
|
198
|
+
end
|
199
|
+
|
200
|
+
it "strips OUTER whitespace" do
|
201
|
+
l_h("5\x00").should_not == l_h("5\x00 ")
|
202
|
+
l_h("5\x00 ").should_not == l_h("5\x00 ")
|
203
|
+
v = VectorEmbed.new
|
204
|
+
v.line(3, 5 => 'hello').should == "3 #{l_h("5\x00hello")}:1"
|
205
|
+
v.line(3, 5 => ' hello ').should == "3 #{l_h("5\x00hello")}:1"
|
206
|
+
v.line(3, 5 => ' hel lo ').should == "3 #{l_h("5\x00hel lo")}:1"
|
207
|
+
end
|
208
|
+
|
173
209
|
it "treats nil like zero in number attributes" do
|
174
210
|
v = VectorEmbed.new
|
175
211
|
v.line(1, 1 => 1) # establish it's a number
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vector_embed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: murmurhash3
|