picky 3.0.0.pre4 → 3.0.0.pre5

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,7 +39,7 @@ module Picky
39
39
 
40
40
  Picky.logger && Picky.logger.info(results.to_log(params[query_key]))
41
41
 
42
- respond_with results.to_response, content_type
42
+ respond_with results.to_json, content_type
43
43
  end
44
44
  end
45
45
 
data/lib/picky/results.rb CHANGED
@@ -27,9 +27,7 @@ module Picky
27
27
 
28
28
  # Returns a hash with the allocations, offset, duration and total.
29
29
  #
30
- # TODO Rename to_h?
31
- #
32
- def serialize
30
+ def to_hash
33
31
  { allocations: allocations.to_result,
34
32
  offset: offset,
35
33
  duration: duration,
@@ -38,11 +36,8 @@ module Picky
38
36
  # Convert to json format.
39
37
  #
40
38
  def to_json options = {}
41
- serialize.to_json options
39
+ to_hash.to_json options
42
40
  end
43
- # The default format is json.
44
- #
45
- alias to_response to_json
46
41
 
47
42
  # This starts the actual processing.
48
43
  #
@@ -60,13 +60,13 @@ describe Picky::Results do
60
60
  @results = described_class.new
61
61
  end
62
62
  it 'should do it correctly' do
63
- @results.stub! :serialize => :serialized
63
+ @results.stub! :to_hash => :serialized
64
64
 
65
65
  @results.to_json.should == '"serialized"'
66
66
  end
67
67
  end
68
68
 
69
- describe 'serialize' do
69
+ describe 'to_hash' do
70
70
  before(:each) do
71
71
  @allocations = stub :allocations, :process! => nil, :to_result => :allocations, :total => :some_total
72
72
 
@@ -76,7 +76,7 @@ describe Picky::Results do
76
76
  it 'should do it correctly' do
77
77
  @results.prepare!
78
78
 
79
- @results.serialize.should == { :allocations => :allocations, :offset => :some_offset, :duration => :some_duration, :total => :some_total }
79
+ @results.to_hash.should == { :allocations => :allocations, :offset => :some_offset, :duration => :some_duration, :total => :some_total }
80
80
  end
81
81
  end
82
82
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 3.0.0.pre4
5
+ version: 3.0.0.pre5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - "="
34
34
  - !ruby/object:Gem::Version
35
- version: 3.0.0.pre4
35
+ version: 3.0.0.pre5
36
36
  type: :development
37
37
  version_requirements: *id002
38
38
  description: Fast Ruby semantic text search engine with comfortable single field interface.