tablature 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 37da9dc068662c878b97c2f7cf95274f9893d4a34940d9511db0933d98b3597c
4
- data.tar.gz: 261087c9165cba3aa60d4999f398889725979fa0398a5775c2408c0e41a420bb
3
+ metadata.gz: c0f01e862c6cb003f9b1bc86743f0254cccef3637fa87f84ea32b4c96f35b6e3
4
+ data.tar.gz: 53694558d02632d0445cba1d699b996d822d5954a2103eba18e90a9368f23878
5
5
  SHA512:
6
- metadata.gz: e66f6acf2ae0bbc061b92153b5f3ba798dd37f69302e2f6de5b6cf5363bdc3d8ce3bed6442017b6d85ef4aab52e96301056f72a16a393282396042c4d54334e1
7
- data.tar.gz: 3855a566bc693bf97c7b20b2871703bb766fcd2553ef1e0043d5d18c47d7cc80eb60e779b0d2d9baf83aa2447379f9486de7104cb05945b2cc86adc9485fd537
6
+ metadata.gz: f5adfa4f8f12f91c123d34c0425fcc1554fbe79f69feb33667626591c5ebcb24ad983574a16a7f70179524e645ed79c341c143592904ce056bcac01933eab5c5
7
+ data.tar.gz: d26d13cf166673c56d341aedeecd948a563942c6bf0720b5ff01d6bffd22ee9d2b1de0576e0c88891b2a2a0e551aa192b9e0c32a8dc2f66050edce43ce42a9ee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tablature (0.2.0)
4
+ tablature (0.3.0)
5
5
  activerecord (>= 5.0.0)
6
6
  railties (>= 5.0.0)
7
7
 
@@ -48,7 +48,7 @@ GEM
48
48
  method_source (0.9.0)
49
49
  mini_portile2 (2.4.0)
50
50
  minitest (5.11.3)
51
- nokogiri (1.10.0)
51
+ nokogiri (1.10.1)
52
52
  mini_portile2 (~> 2.4.0)
53
53
  pg (0.21.0)
54
54
  pry (0.12.2)
@@ -1,5 +1,3 @@
1
- require 'tablature/model/partition_methods'
2
-
3
1
  module Tablature
4
2
  module Model
5
3
  module ListPartitionMethods
@@ -15,15 +13,36 @@ module Tablature
15
13
  end
16
14
 
17
15
  module ClassMethods
16
+ extend Forwardable
17
+
18
+ def_delegators :tablature_partition, :partitions, :partition_key, :partitioning_method
19
+
20
+ def partitioned?
21
+ begin
22
+ tablature_partition
23
+ rescue Tablature::MissingPartition
24
+ return false
25
+ end
26
+
27
+ true
28
+ end
29
+
30
+ def tablature_partition
31
+ partition = Tablature.database.partitioned_tables.find do |pt|
32
+ pt.name == partition_name.to_s
33
+ end
34
+ raise Tablature::MissingPartition if partition.nil?
35
+
36
+ partition
37
+ end
38
+
18
39
  def list_partition(partition_name = table_name)
19
40
  setup_partition(partition_name)
20
- extend(PartitionMethods)
21
41
  extend(ListPartitionMethods)
22
42
  end
23
43
 
24
44
  def range_partition(partition_name = table_name)
25
45
  setup_partition(partition_name)
26
- extend(PartitionMethods)
27
46
  extend(RangePartitionMethods)
28
47
  end
29
48
 
@@ -1,3 +1,3 @@
1
1
  module Tablature
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tablature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliou Diallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-12 00:00:00.000000000 Z
11
+ date: 2019-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,7 +154,6 @@ files:
154
154
  - lib/tablature/command_recorder.rb
155
155
  - lib/tablature/configuration.rb
156
156
  - lib/tablature/model.rb
157
- - lib/tablature/model/partition_methods.rb
158
157
  - lib/tablature/partitioned_table.rb
159
158
  - lib/tablature/railtie.rb
160
159
  - lib/tablature/schema_dumper.rb
@@ -1,29 +0,0 @@
1
- require 'forwardable'
2
-
3
- module Tablature
4
- module Model
5
- module PartitionMethods
6
- extend Forwardable
7
- def_delegators :tablature_partition, :partitions, :partition_key, :partitioning_method
8
-
9
- def tablature_partition
10
- partition = Tablature.database.partitioned_tables.find do |pt|
11
- pt.name == partition_name.to_s
12
- end
13
- raise Tablature::MissingPartition if partition.nil?
14
-
15
- partition
16
- end
17
-
18
- def partitioned?
19
- begin
20
- tablature_partition
21
- rescue Tablature::MissingPartition
22
- return false
23
- end
24
-
25
- true
26
- end
27
- end
28
- end
29
- end