sequel_bitemporal 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/sequel/plugins/bitemporal.rb +10 -1
- data/sequel_bitemporal.gemspec +1 -1
- data/spec/bitemporal_date_spec.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc21e82b40ea8f3f5dc15e28ed49dfd2d5cb9b1d
|
4
|
+
data.tar.gz: b96f3457b381585ba37c2b81825c3d387225fabd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c0883049c494836a9579c2442c194e79100587fa2f187ef5a99a8f96e938979e09bf64f2c807e1543a4d4ba2c4f430ce4c14e8700263df9e54f1097a3319c28
|
7
|
+
data.tar.gz: 98d110e00b4f2d4f075f338820bcfbf717790c4447cc87f6049f9b99276fbe159ce8f27cb373a252c1a16a586e8e5ea8a36333d2900d63de00d29a029a7528d8
|
data/README.md
CHANGED
@@ -41,9 +41,12 @@ Usage
|
|
41
41
|
Thanks
|
42
42
|
------
|
43
43
|
|
44
|
-
Thanks to Evgeniy L (fiscal-cliff
|
44
|
+
Thanks to Evgeniy L (@fiscal-cliff) for his contributions:
|
45
45
|
- skip plugin initialization process if versions table does not exist
|
46
46
|
|
47
|
+
Thanks to Ksenia Zalesnaya (@ksenia-zalesnaya) for her contributions:
|
48
|
+
- define setter methods for versioned columns
|
49
|
+
|
47
50
|
License
|
48
51
|
-------
|
49
52
|
|
@@ -182,13 +182,22 @@ module Sequel
|
|
182
182
|
end
|
183
183
|
unless opts[:delegate]==false
|
184
184
|
(version.columns-master.columns-master.excluded_columns).each do |column|
|
185
|
-
master.class_eval <<-EOS
|
185
|
+
master.class_eval <<-EOS, __FILE__, __LINE__ + 1
|
186
186
|
def #{column}
|
187
187
|
pending_or_current_version.#{column} if pending_or_current_version
|
188
188
|
end
|
189
189
|
EOS
|
190
190
|
end
|
191
191
|
end
|
192
|
+
if opts[:writers]
|
193
|
+
(version.columns-master.columns-master.excluded_columns).each do |column|
|
194
|
+
master.class_eval <<-EOS, __FILE__, __LINE__ + 1
|
195
|
+
def #{column}=(value)
|
196
|
+
self.attributes = {"#{column}" => value}
|
197
|
+
end
|
198
|
+
EOS
|
199
|
+
end
|
200
|
+
end
|
192
201
|
end
|
193
202
|
module ClassMethods
|
194
203
|
attr_reader :version_class, :versions_alias, :current_version_alias,
|
data/sequel_bitemporal.gemspec
CHANGED
@@ -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.8.
|
6
|
+
s.version = "0.8.8"
|
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"
|
@@ -585,6 +585,25 @@ describe "Sequel::Plugins::Bitemporal" do
|
|
585
585
|
expect(master.price).to eq(98)
|
586
586
|
DB.drop_table :rooms_with_name
|
587
587
|
end
|
588
|
+
it "allow assigning version attributes in master only with option writers" do
|
589
|
+
closure = @version_class
|
590
|
+
with_writers_class = Class.new Sequel::Model do
|
591
|
+
set_dataset :rooms
|
592
|
+
plugin :bitemporal, version_class: closure, writers: true
|
593
|
+
end
|
594
|
+
master = @master_class.new
|
595
|
+
expect{ master.name = "Single Standard" }.to raise_error NoMethodError
|
596
|
+
master = with_writers_class.new
|
597
|
+
expect(master.attributes).to eq({})
|
598
|
+
expect(master.pending_version).to be_nil
|
599
|
+
expect(master.current_version).to be_nil
|
600
|
+
expect(master.name).to be_nil
|
601
|
+
master.name = "Single Standard"
|
602
|
+
expect(master.attributes).to include({name: "Single Standard"})
|
603
|
+
expect(master.pending_version).to be
|
604
|
+
expect(master.pending_or_current_version.name).to eq("Single Standard")
|
605
|
+
expect(master.name).to eq("Single Standard")
|
606
|
+
end
|
588
607
|
it "get current_version association name from class name" do
|
589
608
|
class MyNameVersion < Sequel::Model
|
590
609
|
set_dataset :room_versions
|
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.8.
|
4
|
+
version: 0.8.8
|
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: 2016-08-
|
12
|
+
date: 2016-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|