picky 3.5.2 → 3.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -94,9 +94,7 @@ module Picky
94
94
  # Clears the weights index.
95
95
  #
96
96
  def clear_weights
97
- # TODO THINK about this. Perhaps the strategies should implement the backend methods?
98
- #
99
- weights.clear if @weights_strategy.saved?
97
+ weights.clear
100
98
  end
101
99
  # Clears the similarity index.
102
100
  #
@@ -51,7 +51,7 @@ module Picky
51
51
  # Dumps the weights index.
52
52
  #
53
53
  def dump_weights
54
- # TODO THINK about this. Perhaps the strategies should implement the backend methods?
54
+ # TODO THINK about this. Perhaps the strategies should implement the backend methods? Or only the internal index ones?
55
55
  #
56
56
  @backend_weights.dump @weights if @weights_strategy.saved?
57
57
  end
@@ -22,6 +22,18 @@ module Picky
22
22
  false
23
23
  end
24
24
 
25
+ # Nothing needs to be deleted from it.
26
+ #
27
+ def delete _
28
+
29
+ end
30
+
31
+ # It does not need to be cleared.
32
+ #
33
+ def clear
34
+
35
+ end
36
+
25
37
  # Returns nil.
26
38
  #
27
39
  def weight_for _
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Picky::Backends::Memory::JSON do
4
-
4
+
5
5
  context 'hash-based indexes' do
6
6
  let(:json) { described_class.new 'some/cache/path/to/file' }
7
7
 
@@ -21,7 +21,7 @@ describe Picky::Backends::Memory::JSON do
21
21
  it "delegates to the given hash" do
22
22
  hash = stub :hash
23
23
 
24
- hash.should_receive(:dump_json).once.with "some/cache/path/to/file.memory.json"
24
+ json.should_receive(:dump_json).once.with hash
25
25
 
26
26
  json.dump hash
27
27
  end
@@ -41,5 +41,5 @@ describe Picky::Backends::Memory::JSON do
41
41
  end
42
42
  end
43
43
  end
44
-
44
+
45
45
  end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Picky::Backends::Memory::Marshal do
4
-
4
+
5
5
  context 'hash-based indexes' do
6
6
  let(:marshal) { described_class.new 'some/cache/path/to/file' }
7
-
7
+
8
8
  describe 'extension' do
9
9
  it 'is correct' do
10
10
  marshal.extension.should == :dump
@@ -16,17 +16,17 @@ describe Picky::Backends::Memory::Marshal do
16
16
  marshal.initial.should == {}
17
17
  end
18
18
  end
19
-
19
+
20
20
  describe "dump" do
21
21
  it "delegates to the given hash" do
22
22
  hash = stub :hash
23
-
24
- hash.should_receive(:dump_marshal).once.with "some/cache/path/to/file.memory.dump"
25
-
23
+
24
+ marshal.should_receive(:dump_marshal).once.with hash
25
+
26
26
  marshal.dump hash
27
27
  end
28
28
  end
29
-
29
+
30
30
  describe "retrieve" do
31
31
  it "raises" do
32
32
  lambda do
@@ -34,12 +34,12 @@ describe Picky::Backends::Memory::Marshal do
34
34
  end.should raise_error("Can't retrieve from marshalled file. Use text file.")
35
35
  end
36
36
  end
37
-
37
+
38
38
  describe 'to_s' do
39
39
  it 'returns the cache path with the default file extension' do
40
40
  marshal.to_s.should == 'Picky::Backends::Memory::Marshal(some/cache/path/to/file.memory.dump)'
41
41
  end
42
42
  end
43
43
  end
44
-
44
+
45
45
  end
@@ -2,38 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Hash do
4
4
 
5
- describe 'dump_to_json' do
6
- it 'uses the right file' do
7
- File.should_receive(:open).once.with('some/file/path.json', 'w')
8
-
9
- {}.dump_json 'some/file/path.json'
10
- end
11
- it "uses the right encoder" do
12
- file = stub :file
13
- File.should_receive(:open).and_yield file
14
-
15
- Yajl::Encoder.should_receive(:encode).once.with({ :some => :hash }, file)
16
-
17
- { :some => :hash }.dump_json 'unimportant'
18
- end
19
- end
20
-
21
- describe 'dump_to_marshalled' do
22
- it 'uses the right file' do
23
- File.should_receive(:open).once.with('some/file/path.dump', 'w:binary')
24
-
25
- {}.dump_marshal 'some/file/path.dump'
26
- end
27
- it "uses the right encoder" do
28
- file = stub :file
29
- File.should_receive(:open).and_yield file
30
-
31
- Marshal.should_receive(:dump).once.with({ :some => :hash }, file)
32
-
33
- { :some => :hash }.dump_marshal 'unimportant'
34
- end
35
- end
36
-
37
5
  describe "to_json" do
38
6
  before(:each) do
39
7
  # A very realistic example.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70173340911540 !ruby/object:Gem::Requirement
16
+ requirement: &70187634558200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70173340911540
24
+ version_requirements: *70187634558200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: picky-client
27
- requirement: &70173340910880 !ruby/object:Gem::Requirement
27
+ requirement: &70187634557140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 3.5.2
32
+ version: 3.5.3
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70173340910880
35
+ version_requirements: *70187634557140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70173340910220 !ruby/object:Gem::Requirement
38
+ requirement: &70187634555420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70173340910220
46
+ version_requirements: *70187634555420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack_fast_escape
49
- requirement: &70173340909640 !ruby/object:Gem::Requirement
49
+ requirement: &70187634532400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70173340909640
57
+ version_requirements: *70187634532400
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: text
60
- requirement: &70173340908980 !ruby/object:Gem::Requirement
60
+ requirement: &70187638728080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70173340908980
68
+ version_requirements: *70187638728080
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: yajl-ruby
71
- requirement: &70173340908180 !ruby/object:Gem::Requirement
71
+ requirement: &70187638724840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70173340908180
79
+ version_requirements: *70187638724840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: activesupport
82
- requirement: &70173340900340 !ruby/object:Gem::Requirement
82
+ requirement: &70187638709600 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '3.0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70173340900340
90
+ version_requirements: *70187638709600
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: activerecord
93
- requirement: &70173340899260 !ruby/object:Gem::Requirement
93
+ requirement: &70187638708380 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '3.0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70173340899260
101
+ version_requirements: *70187638708380
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: unicorn
104
- requirement: &70173340898260 !ruby/object:Gem::Requirement
104
+ requirement: &70187638707640 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70173340898260
112
+ version_requirements: *70187638707640
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: sinatra
115
- requirement: &70173340897160 !ruby/object:Gem::Requirement
115
+ requirement: &70187638706260 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70173340897160
123
+ version_requirements: *70187638706260
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: redis
126
- requirement: &70173340895680 !ruby/object:Gem::Requirement
126
+ requirement: &70187638704300 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *70173340895680
134
+ version_requirements: *70187638704300
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: mysql
137
- requirement: &70173340894720 !ruby/object:Gem::Requirement
137
+ requirement: &70187638701660 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,7 +142,7 @@ dependencies:
142
142
  version: '0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *70173340894720
145
+ version_requirements: *70187638701660
146
146
  description: Fast Ruby semantic text search engine with comfortable single field interface.
147
147
  email: florian.hanke+picky@gmail.com
148
148
  executables: