-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnobrainer_runner.rb
More file actions
51 lines (40 loc) · 988 Bytes
/
nobrainer_runner.rb
File metadata and controls
51 lines (40 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require './runner'
require 'nobrainer'
class NoBrainerPost
include NoBrainer::Document
field :title#, type: String
field :body#, type: String
field :posted_at#, type: Date
end
class NoBrainerRunner < Runner
def initialize
super
NoBrainer.configure do |config|
config.rethinkdb_url = "rethinkdb://localhost/rethink_benchmarks"
config.logger = nil
config.warn_on_active_record = true
#config.auto_create_database = true
config.auto_create_tables = true
config.cache_documents = true
config.max_reconnection_tries = 10
config.durability = :soft
end
end
def title
'NoBrainer'
end
def setup
NoBrainerPost.delete_all
end
def insert(attrs)
post = NoBrainerPost.create! attrs
post.id
end
def read(id)
NoBrainerPost.find id
end
def update(id, attrs)
post = NoBrainerPost.find id
post.update_attributes attrs
end
end