look_up_table 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/look_up_table.rb +4 -48
- data/lib/look_up_table/version.rb +1 -1
- metadata +8 -8
data/lib/look_up_table.rb
CHANGED
@@ -1,13 +1,5 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# end
|
4
|
-
|
5
|
-
# # Page.page_title_lut("Berlin") => 14954
|
6
|
-
# look_up_table :page_title
|
7
|
-
|
8
|
-
# # Page.lut(:page_title, "Berlin")
|
9
|
-
|
10
|
-
|
1
|
+
# TODO
|
2
|
+
# * add: lut_reset(:name)
|
11
3
|
module LookUpTable
|
12
4
|
extend ActiveSupport::Concern
|
13
5
|
|
@@ -34,6 +26,7 @@ module LookUpTable
|
|
34
26
|
end
|
35
27
|
|
36
28
|
# Write a LookUpTable into Cache
|
29
|
+
# TODO refactor
|
37
30
|
def lut_write_to_cache(batch_size, lut_name, sql_mode)
|
38
31
|
if sql_mode
|
39
32
|
if block_given?
|
@@ -125,38 +118,6 @@ module LookUpTable
|
|
125
118
|
return @@look_up_tables[lut_name.to_sym]
|
126
119
|
end
|
127
120
|
|
128
|
-
|
129
|
-
|
130
|
-
# # Write Keys of cached Items to cache
|
131
|
-
# # TODO *key_batch_size
|
132
|
-
# def lut_write_cache_keys(lut_name, keys)
|
133
|
-
# key_batch_size = 10000
|
134
|
-
# keys.uniq!
|
135
|
-
# i = 0
|
136
|
-
# while key_block = keys.slice!(0,key_batch_size)
|
137
|
-
# lut_write_cache_key_block(lut_name, i, key_block)
|
138
|
-
# i += 1
|
139
|
-
# end
|
140
|
-
# end
|
141
|
-
|
142
|
-
# # Write a single KeyBlock into LookUpTable-Key-Cache
|
143
|
-
# def lut_write_cache_key_block(lut_name, key_item, key_data)
|
144
|
-
# status = Rails.cache.write("#{lut_name}/k/#{key_item}", key_data)
|
145
|
-
# Raise "Cache::write returned false" unless status
|
146
|
-
# end
|
147
|
-
|
148
|
-
# # TODO desc
|
149
|
-
# def lut_read_cache_keys(lut_name)
|
150
|
-
# #TODO
|
151
|
-
# end
|
152
|
-
|
153
|
-
# # TODO desc
|
154
|
-
# def lut_read_cache_key_block(lut_name, key_item)
|
155
|
-
# Rails.cache.read("#{lut_name}/k/#{key_item}")
|
156
|
-
# end
|
157
|
-
|
158
|
-
|
159
|
-
|
160
121
|
# Delegating <attribute>_lut(args) method calls
|
161
122
|
def method_missing(m, *args, &block)
|
162
123
|
method_name = m.to_s
|
@@ -167,13 +128,8 @@ module LookUpTable
|
|
167
128
|
raise "MethodNotFound: #{m}"
|
168
129
|
end
|
169
130
|
end
|
170
|
-
end
|
171
131
|
|
172
|
-
|
173
|
-
# module InstanceMethods
|
174
|
-
# def foobar
|
175
|
-
# end
|
176
|
-
# end
|
132
|
+
end
|
177
133
|
end
|
178
134
|
|
179
135
|
ActiveRecord::Base.send :include, LookUpTable
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: look_up_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &72766240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *72766240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &72766030 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *72766030
|
36
36
|
description: A simple LookUpTable to cache large (!) and static(!) data
|
37
37
|
email:
|
38
38
|
- ph@werbeboten.de
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash:
|
93
|
+
hash: 1020250429
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 1020250429
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.10
|