chronological 1.0.0beta9 → 1.0.0beta10

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,8 @@ module Chronological
40
40
  end
41
41
 
42
42
  def has_absolute_timeframe?(object)
43
- object.send(field_names[:starting_time]).present? && object.send(field_names[:ending_time]).present?
43
+ object.send(field_names[:starting_time]).present? &&
44
+ object.send(field_names[:ending_time]).present?
44
45
  end
45
46
  end
46
47
  end
@@ -53,15 +53,15 @@ module Chronological
53
53
  def in_progress?(object)
54
54
  return false unless has_absolute_timeframe?(object)
55
55
 
56
- (object.send(field_names[:starting_time]) <= Time.now.utc) && object.send(field_names[:ending_time]).future?
56
+ started?(object) && !ended?(object)
57
57
  end
58
58
 
59
- def started?(object, options = {})
60
- Time.now >= object.send(field_names[:starting_time], options)
59
+ def started?(object, *args)
60
+ Time.now.utc >= object.send(field_names[:starting_time], *args)
61
61
  end
62
62
 
63
- def ended?(object, options = {})
64
- Time.now >= object.send(field_names[:ending_time], options)
63
+ def ended?(object, *args)
64
+ Time.now.utc >= object.send(field_names[:ending_time], *args)
65
65
  end
66
66
 
67
67
  def not_yet_ended?(object, options = {})
@@ -20,14 +20,6 @@ module Chronological
20
20
  scheduled_time_zone(object, false).present?
21
21
  end
22
22
 
23
- def self.in_progress(object, field_names)
24
- object.all.select(&:in_progress?)
25
- end
26
-
27
- def self.in_progress?(object, field_names)
28
- object.all.any?(&:in_progress?)
29
- end
30
-
31
23
  def has_absolute_start?
32
24
  true
33
25
  end
@@ -56,7 +48,8 @@ module Chronological
56
48
  end
57
49
 
58
50
  def has_absolute_timeframe?(object)
59
- object.scheduled?
51
+ object.send(field_names[:starting_time]).present? &&
52
+ object.send(field_names[:duration]).present?
60
53
  end
61
54
  end
62
55
  end
@@ -30,14 +30,6 @@ module Chronological
30
30
  scheduled_time_zone(object, false).present?
31
31
  end
32
32
 
33
- def self.in_progress(object, field_names)
34
- object.all.select(&:in_progress?)
35
- end
36
-
37
- def self.in_progress?(object, field_names)
38
- object.all.any?(&:in_progress?)
39
- end
40
-
41
33
  def has_absolute_start?
42
34
  false
43
35
  end
@@ -60,13 +52,16 @@ module Chronological
60
52
  end
61
53
 
62
54
  def duration_in_seconds(object)
63
- return nil unless object.send(field_names[:starting_offset]).present? && object.send(field_names[:ending_offset]).present?
55
+ return nil unless object.send(field_names[:starting_offset]).present? &&
56
+ object.send(field_names[:ending_offset]).present?
64
57
 
65
58
  object.send(field_names[:starting_offset]) - object.send(field_names[:ending_offset])
66
59
  end
67
60
 
68
61
  def has_absolute_timeframe?(object)
69
- object.scheduled?
62
+ object.send(field_names[:base_of_offset]).present? &&
63
+ object.send(field_names[:starting_offset]).present? &&
64
+ object.send(field_names[:ending_offset]).present?
70
65
  end
71
66
  end
72
67
  end
@@ -1,3 +1,3 @@
1
1
  module Chronological
2
- VERSION = '1.0.0beta9'
2
+ VERSION = '1.0.0beta10'
3
3
  end
@@ -382,6 +382,36 @@ describe Chronological::AbsoluteStrategy do
382
382
  end
383
383
  end
384
384
 
385
+ describe '.started' do
386
+ it 'is empty' do
387
+ AbsoluteChronologicable.started.should be_empty
388
+ end
389
+ end
390
+
391
+ describe '.ended' do
392
+ it 'is empty' do
393
+ AbsoluteChronologicable.ended.should be_empty
394
+ end
395
+ end
396
+
397
+ describe '.not_yet_ended' do
398
+ it 'is empty' do
399
+ AbsoluteChronologicable.not_yet_ended.should be_empty
400
+ end
401
+ end
402
+
403
+ describe '.in_progress' do
404
+ it 'is empty' do
405
+ AbsoluteChronologicable.in_progress.should be_empty
406
+ end
407
+ end
408
+
409
+ describe '.in_progress?' do
410
+ it 'is false' do
411
+ AbsoluteChronologicable.should_not be_in_progress
412
+ end
413
+ end
414
+
385
415
  context 'but the time zone is blank' do
386
416
  let(:time_zone) { '' }
387
417
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chronological
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0beta9
4
+ version: 1.0.0beta10
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors: