orm-redis 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/orm-redis.rb +24 -0
- data/orm-redis.gemspec +27 -0
- metadata +78 -0
data/lib/orm-redis.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'redis'
|
2
|
+
|
3
|
+
module OrmRedis
|
4
|
+
class Base
|
5
|
+
@@connection = Redis.new
|
6
|
+
@@class_name = self.to_s
|
7
|
+
@@fields = []
|
8
|
+
|
9
|
+
def self.property name
|
10
|
+
@@fields << name
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.create options
|
14
|
+
options.each do |key, value|
|
15
|
+
raise "field not supported" unless @@fields.include? key
|
16
|
+
@@connection.hset(@@class_name, key, value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.find
|
21
|
+
@@connection.hmget(@@class_name, *@@fields)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/orm-redis.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
4
|
+
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "orm-redis"
|
8
|
+
|
9
|
+
s.version = "0.0.0"
|
10
|
+
|
11
|
+
|
12
|
+
s.summary = "redis orm"
|
13
|
+
|
14
|
+
s.description = <<-EOS
|
15
|
+
redis orm
|
16
|
+
EOS
|
17
|
+
|
18
|
+
s.authors = ["Cui Liqiang"]
|
19
|
+
|
20
|
+
s.email = ["cui.liqiang@gmail.com"]
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
|
+
|
26
|
+
s.add_development_dependency("redis")
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orm-redis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 0.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Cui Liqiang
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2012-04-10 00:00:00 +08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: redis
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :development
|
32
|
+
version_requirements: *id001
|
33
|
+
description: " redis orm\n"
|
34
|
+
email:
|
35
|
+
- cui.liqiang@gmail.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- lib/orm-redis.rb
|
44
|
+
- orm-redis.gemspec
|
45
|
+
has_rdoc: true
|
46
|
+
homepage:
|
47
|
+
licenses: []
|
48
|
+
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.3.7
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: redis orm
|
77
|
+
test_files: []
|
78
|
+
|