sequel_bitemporal 0.7.4 → 0.7.6

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: a3da00a0fbebc057ceef2fac9ff034f84ff72ac8
4
- data.tar.gz: 6cad91c39130b5ca76f9e969d0dbb6d514163668
3
+ metadata.gz: f7c7f5e2047c457a89ed6be9bb453988def0043e
4
+ data.tar.gz: d54425b6efc1010a6fa07db20b0fd0d4047d7340
5
5
  SHA512:
6
- metadata.gz: 6cac6a6424ba8f3a966f453644e3099c2ff2cfe2d4fdfb4d0c0e85b886fa80f47a6aa755a031871f59c273086534b4efe941be051fb0eae5ddace10487ecda3c
7
- data.tar.gz: a28780d32a14df07666afe8e7fe242488a7eb1384effdee3a2a2441b1c9f052eda666e820405b3925f5934f70d5c21b2fe32060f95bd395ec6e36cb63a0f231c
6
+ metadata.gz: fc85f0136dc75bb62f85bfde64390a7709eb091c030829888b86e7cf4449681d59b29ced93cdcbd4939f271718abd5ff9c5ff05a451b0fb3124e1bb2419b70d0
7
+ data.tar.gz: ae9991450de419171deb5687c4d75e00257427e786a7dd5caf5dbdd79f3e02914d0f9e3ebf58a314adc058dd1729863129514f361cf544f19dac7eca0af44d88
data/.travis.yml CHANGED
@@ -1,9 +1,8 @@
1
1
  rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
- - 2.1.0
4
+ - 2.1
5
5
  - jruby-19mode
6
- - jruby-20mode
7
6
  env:
8
7
  - SQLITE=1
9
8
  - PG=1
@@ -70,6 +70,18 @@ module Sequel
70
70
  false
71
71
  end
72
72
  end
73
+ master.class_eval do
74
+ def self.current_versions_dataset
75
+ t = ::Sequel::Plugins::Bitemporal.point_in_time
76
+ n = ::Sequel::Plugins::Bitemporal.now
77
+ version_class.where do
78
+ (created_at <= t) &
79
+ (Sequel.|({expired_at=>nil}, expired_at > t)) &
80
+ (valid_from <= n) &
81
+ (valid_to > n)
82
+ end
83
+ end
84
+ end
73
85
  master.one_to_many :versions, class: version, key: :master_id, graph_alias_base: master.versions_alias
74
86
  master.one_to_one :current_version, class: version, key: :master_id, graph_alias_base: master.current_version_alias, :graph_block=>(proc do |j, lj, js|
75
87
  t = ::Sequel::Plugins::Bitemporal.point_in_time
@@ -578,4 +590,3 @@ module Sequel
578
590
  end
579
591
  end
580
592
  end
581
-
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "sequel_bitemporal"
6
- s.version = "0.7.4"
6
+ s.version = "0.7.6"
7
7
  s.authors = ["Joseph HALTER", "Jonathan TRON"]
8
8
  s.email = ["joseph.halter@thetalentbox.com", "jonathan.tron@thetalentbox.com"]
9
9
  s.homepage = "https://github.com/TalentBox/sequel_bitemporal"
@@ -20,6 +20,14 @@ describe "Sequel::Plugins::Bitemporal" do
20
20
  @version_class.plugin :bitemporal, version_class: @master_class
21
21
  }.should raise_error Sequel::Error, "bitemporal plugin requires the following missing columns on version class: master_id, valid_from, valid_to, created_at, expired_at"
22
22
  end
23
+ it "defines current_versions_dataset" do
24
+ @master_class.new.
25
+ update_attributes(name: "Single Standard", price: 98).
26
+ update_attributes(name: "King Size")
27
+ versions = @master_class.current_versions_dataset.all
28
+ versions.should have(1).version
29
+ versions[0].name.should == "King Size"
30
+ end
23
31
  it "propagates errors from version to master" do
24
32
  master = @master_class.new
25
33
  master.should be_valid
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_bitemporal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph HALTER
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-15 00:00:00.000000000 Z
12
+ date: 2014-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel