sequel_bitemporal 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/sequel/plugins/bitemporal.rb +5 -4
- data/sequel_bitemporal.gemspec +1 -1
- data/spec/bitemporal_date_spec.rb +14 -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: 227ff043766a6030bde1ae6f9d5e58a771abb807
|
4
|
+
data.tar.gz: 5639c0e12d4fd9f00756f9d94d8bddd03da50fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea940479cac3610e982e9ec7f00cb5a2dafe9cb710e0784109aef31aebce7537c8ee241be5c94fcfe4296324a29f1749278eaee6a7859359682c837464f61645
|
7
|
+
data.tar.gz: 48548892a85814d45aeed26f383aa5262eacd944701a13a38048888ea8d7baac69eb19e5a898ff08dfd1cf84293179f04482415bb6401c115a5efaf68f0c5d80
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.2
|
@@ -60,6 +60,8 @@ module Sequel
|
|
60
60
|
@audit_updated_by_method = opts.fetch(:audit_updated_by_method){ :updated_by }
|
61
61
|
@propagate_per_column = opts.fetch(:propagate_per_column, false)
|
62
62
|
@version_uses_string_nilifier = version.plugins.map(&:to_s).include? "Sequel::Plugins::StringNilifier"
|
63
|
+
@excluded_columns = Sequel::Plugins::Bitemporal.bitemporal_excluded_columns
|
64
|
+
@excluded_columns += Array opts[:excluded_columns] if opts[:excluded_columns]
|
63
65
|
@use_ranges = if opts[:ranges]
|
64
66
|
db = self.db
|
65
67
|
unless db.database_type==:postgres && db.server_version >= 90200
|
@@ -172,7 +174,7 @@ module Sequel
|
|
172
174
|
end
|
173
175
|
end
|
174
176
|
unless opts[:delegate]==false
|
175
|
-
(version.columns-
|
177
|
+
(version.columns-master.excluded_columns).each do |column|
|
176
178
|
master.class_eval <<-EOS
|
177
179
|
def #{column}
|
178
180
|
pending_or_current_version.#{column} if pending_or_current_version
|
@@ -184,7 +186,7 @@ module Sequel
|
|
184
186
|
module ClassMethods
|
185
187
|
attr_reader :version_class, :versions_alias, :current_version_alias,
|
186
188
|
:propagate_per_column, :audit_class, :audit_updated_by_method,
|
187
|
-
:version_uses_string_nilifier, :use_ranges
|
189
|
+
:version_uses_string_nilifier, :use_ranges, :excluded_columns
|
188
190
|
|
189
191
|
def validity_range_type
|
190
192
|
@validity_range_type ||= begin
|
@@ -252,7 +254,6 @@ module Sequel
|
|
252
254
|
Sequel.cast(now, validity_cast_type)
|
253
255
|
)
|
254
256
|
end
|
255
|
-
|
256
257
|
end
|
257
258
|
module DatasetMethods
|
258
259
|
end
|
@@ -579,7 +580,7 @@ module Sequel
|
|
579
580
|
end
|
580
581
|
|
581
582
|
def excluded_columns
|
582
|
-
|
583
|
+
self.class.excluded_columns
|
583
584
|
end
|
584
585
|
|
585
586
|
def initial_version
|
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.7.
|
6
|
+
s.version = "0.7.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"
|
@@ -528,6 +528,7 @@ describe "Sequel::Plugins::Bitemporal" do
|
|
528
528
|
master.name.should == "Single Standard"
|
529
529
|
master.attributes = {name: "King Size"}
|
530
530
|
master.name.should == "King Size"
|
531
|
+
master.price.should == 98
|
531
532
|
end
|
532
533
|
it "avoids delegation with option delegate: false" do
|
533
534
|
closure = @version_class
|
@@ -536,7 +537,20 @@ describe "Sequel::Plugins::Bitemporal" do
|
|
536
537
|
plugin :bitemporal, version_class: closure, delegate: false
|
537
538
|
end
|
538
539
|
master = without_delegation_class.new
|
540
|
+
master.attributes = {name: "Single Standard", price: 98}
|
539
541
|
expect{ master.name }.to raise_error NoMethodError
|
542
|
+
expect{ master.price }.to raise_error NoMethodError
|
543
|
+
end
|
544
|
+
it "avoids delegation of some columns only with option excluded_columns" do
|
545
|
+
closure = @version_class
|
546
|
+
without_delegation_class = Class.new Sequel::Model do
|
547
|
+
set_dataset :rooms
|
548
|
+
plugin :bitemporal, version_class: closure, excluded_columns: [:name]
|
549
|
+
end
|
550
|
+
master = without_delegation_class.new
|
551
|
+
master.attributes = {name: "Single Standard", price: 98}
|
552
|
+
expect{ master.name }.to raise_error NoMethodError
|
553
|
+
master.price.should == 98
|
540
554
|
end
|
541
555
|
it "get current_version association name from class name" do
|
542
556
|
class MyNameVersion < Sequel::Model
|
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
|
+
version: 0.7.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: 2014-07
|
12
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|