rails_rank 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a226174d165b3f53c80a2220a072dffc7f46e49d
4
- data.tar.gz: 071e16d3ec71e8b59f9a54d786d43914f8ef9040
3
+ metadata.gz: cd3b3e220f5f0a5281a1c3b4619c9462d9586ce2
4
+ data.tar.gz: cca1583c2edc1f83a1c7e94038437d41fd345f80
5
5
  SHA512:
6
- metadata.gz: daa60282c8d910a6b448aaabf2d38b1406038fce36b5948ba6f6886e0248e4dacd087ab6e8087c79fb0a545f33250fca722440a6d72fc5150bbd4a906b4a8411
7
- data.tar.gz: b586bd44ae43fc4571e84258837c46c6fd665b3fb4056f7b52d5c17350614ee6286e1312dc6e78a54c867a41722c76284560ed0abe57031d6ecab840f4254741
6
+ metadata.gz: 7658f311e86849875e4b7684bbfe47841bda250e84b936abd732ec9e1437ee09e6d29ee37396f31605312402275e0a8fa2c997771253c5fa28dd302e12d2d1e4
7
+ data.tar.gz: d7d9a80f8326e9152cdace0d27366a2eee8571038bf71d1acee95d1749b6dee62eebdee72d88bb20ccc84dfbba4beb7f962727a98ac6c92b994170ad1c759f9c
@@ -42,5 +42,12 @@ module Rankings
42
42
  # @param position [Integer] position of value.
43
43
  def self.after_table(date_type, time, value, score, position)
44
44
  end
45
+
46
+ # callbacked after table all data of the time slot.
47
+ #
48
+ # @param date_type [RailsRank::Types::Date] the type of tabulation.
49
+ # @param base_time [Time] the base time of tabulation.
50
+ def self.after_table_all(date_type, base_time)
51
+ end
45
52
  end
46
53
  end
@@ -51,5 +51,13 @@ module RailsRank
51
51
  # @param position [Integer] position of value.
52
52
  def self.after_table(date_type, time, value, score, position)
53
53
  end
54
+
55
+ # callbacked after table all data of the time slot.
56
+ #
57
+ # @param date_type [RailsRank::Types::Date] the type of tabulation.
58
+ # @param base_time [Time] the base time of tabulation.
59
+ def self.after_table_all(date_type, base_time)
60
+ end
61
+
54
62
  end
55
63
  end
@@ -125,7 +125,7 @@ module RailsRank
125
125
  tabled_data_count += 1
126
126
  end
127
127
  end
128
-
128
+ after_table_all(date_type, base_time)
129
129
  return tabled_data_count
130
130
  end
131
131
 
@@ -1,3 +1,3 @@
1
1
  module RailsRank
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -25,7 +25,7 @@ describe RailsRank::DefinedBaseMethods do
25
25
  end
26
26
 
27
27
  @defined_base_methods = IncludeDefinedBaseMethods.new
28
- @defined_base_methods.stub({ rails_kvs_driver: @driver, rails_kvs_driver_config: @driver_config, after_table: nil })
28
+ @defined_base_methods.stub({ rails_kvs_driver: @driver, rails_kvs_driver_config: @driver_config, after_table: nil, after_table_all: nil })
29
29
 
30
30
  Time.stub({ now: Time.local(2013,11,5) })
31
31
 
@@ -179,11 +179,17 @@ describe RailsRank::DefinedBaseMethods do
179
179
  }.by(-1)
180
180
  end
181
181
 
182
- it 'callback with date' do
182
+ it 'after_table callbacked' do
183
183
  args = [RailsRank::Types::Date::HOURLY, Time.local(2013,11,5), 'NyarukoSan', 2865, 0]
184
184
  @defined_base_methods.should_receive(:after_table).with(*args)
185
185
  @defined_base_methods.table(RailsRank::Types::Date::HOURLY)
186
186
  end
187
+
188
+ it 'after_table_all callbacked' do
189
+ args = [RailsRank::Types::Date::HOURLY, Time.local(2013, 11, 5, 1)]
190
+ @defined_base_methods.should_receive(:after_table_all).with(*args)
191
+ @defined_base_methods.table(RailsRank::Types::Date::HOURLY)
192
+ end
187
193
 
188
194
  it 'return tabled data number.' do
189
195
  expect(@defined_base_methods.table(RailsRank::Types::Date::HOURLY)). to eq(1)
@@ -225,11 +231,17 @@ describe RailsRank::DefinedBaseMethods do
225
231
  }.by(-1)
226
232
  end
227
233
 
228
- it 'callback with date' do
234
+ it 'after_table callbaked' do
229
235
  args = [RailsRank::Types::Date::DAILY, Time.local(2013,11,5), 'NyarukoSan', 2865, 0]
230
236
  @defined_base_methods.should_receive(:after_table).with(*args)
231
237
  @defined_base_methods.table(RailsRank::Types::Date::DAILY)
232
238
  end
239
+
240
+ it 'after_table_all callbacked' do
241
+ args = [RailsRank::Types::Date::DAILY, Time.local(2013, 11, 6)]
242
+ @defined_base_methods.should_receive(:after_table_all).with(*args)
243
+ @defined_base_methods.table(RailsRank::Types::Date::DAILY)
244
+ end
233
245
  end
234
246
 
235
247
  context 'with RailsRank::Types::Date::MONTHLY' do
@@ -255,11 +267,17 @@ describe RailsRank::DefinedBaseMethods do
255
267
  }.by(-1)
256
268
  end
257
269
 
258
- it 'callback with date' do
270
+ it 'after_table callbacked' do
259
271
  args = [RailsRank::Types::Date::MONTHLY, Time.local(2013,11), 'NyarukoSan', 2865, 0]
260
272
  @defined_base_methods.should_receive(:after_table).with(*args)
261
273
  @defined_base_methods.table(RailsRank::Types::Date::MONTHLY)
262
274
  end
275
+
276
+ it 'after_table_all callbacked' do
277
+ args = [RailsRank::Types::Date::MONTHLY, Time.local(2013, 12)]
278
+ @defined_base_methods.should_receive(:after_table_all).with(*args)
279
+ @defined_base_methods.table(RailsRank::Types::Date::MONTHLY)
280
+ end
263
281
  end
264
282
 
265
283
  context 'with RailsRank::Types::Date::YEARLY' do
@@ -278,11 +296,17 @@ describe RailsRank::DefinedBaseMethods do
278
296
  }.by(-1)
279
297
  end
280
298
 
281
- it 'callback with date' do
299
+ it 'after_table callbacked' do
282
300
  args = [RailsRank::Types::Date::YEARLY, Time.local(2013), 'NyarukoSan', 2865, 0]
283
301
  @defined_base_methods.should_receive(:after_table).with(*args)
284
302
  @defined_base_methods.table(RailsRank::Types::Date::YEARLY)
285
303
  end
304
+
305
+ it 'after_table_all callbacked' do
306
+ args = [RailsRank::Types::Date::YEARLY, Time.local(2014, 1)]
307
+ @defined_base_methods.should_receive(:after_table_all).with(*args)
308
+ @defined_base_methods.table(RailsRank::Types::Date::YEARLY)
309
+ end
286
310
  end
287
311
  end
288
312
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_rank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - alfa-jpn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-17 00:00:00.000000000 Z
11
+ date: 2013-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler