tsukasaoishi-miyazakiresistance 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +18 -1
- data/initializers/rdb.rb +13 -0
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ MiyazakiResistance is a library like ActiveRecord to use Tokyo Tyrant.
|
|
8
8
|
|
9
9
|
== SYNOPSIS:
|
10
10
|
|
11
|
-
require '
|
11
|
+
require 'miyazakiresistance'
|
12
12
|
class Example < MiyazakiResistance::Base
|
13
13
|
set_server "localhost", 1975, :write
|
14
14
|
set_server "slave", 1975, :standby
|
@@ -19,6 +19,23 @@ MiyazakiResistance is a library like ActiveRecord to use Tokyo Tyrant.
|
|
19
19
|
set_column :created_at, :datetime, :index
|
20
20
|
end
|
21
21
|
|
22
|
+
work = Example.new
|
23
|
+
work.name = "tsukasa"
|
24
|
+
work.age = 34
|
25
|
+
work.birthday => Date.today
|
26
|
+
work.save
|
27
|
+
|
28
|
+
Example.create(:name => "oishi", :age => 14, :birthday => Date.today)
|
29
|
+
|
30
|
+
Example.count
|
31
|
+
Example.count(:conditions => ["name = ?", "oishi"])
|
32
|
+
|
33
|
+
Example.find(1)
|
34
|
+
Example.find([1,2])
|
35
|
+
Example.find(:first)
|
36
|
+
Example.find(:all)
|
37
|
+
Example.find(:all, :conditions => ["name = ? age = ?", "tsukasa", 34], :order => "created_at DESC", :offset => 1, :limit => 1)
|
38
|
+
|
22
39
|
== REQUIREMENTS:
|
23
40
|
|
24
41
|
Tokyo Tyrant
|
data/initializers/rdb.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module TokyoTyrant
|
2
|
+
class RDB
|
3
|
+
attr_accessor :host, :port
|
4
|
+
|
5
|
+
def open_with_save_params(host, port = 0)
|
6
|
+
@host = host
|
7
|
+
@port = port
|
8
|
+
open_without_save_params(host, port)
|
9
|
+
end
|
10
|
+
alias_method :open_without_save_params, :open
|
11
|
+
alias_method :open, :open_with_save_params
|
12
|
+
end
|
13
|
+
end
|