activerecord-bitemporal-tablize 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae131bf581a0e9a7bfef125b093fac9e69238dfb9cae955a8618f8bb74a8fdba
4
- data.tar.gz: 3c6919b96f711bd2729d885677783e9752810ff4d98231bd846d51ad1dec6420
3
+ metadata.gz: 70de8844f5350436e2c63ba028631191b4945c9438c7a9fe38edb15da92078b0
4
+ data.tar.gz: f4158dd30e7e2d57671cf560c40afd1dc440c200c4bf3ac6c71b8e34163bbfa6
5
5
  SHA512:
6
- metadata.gz: e50e46763fe730ae5cde090f605502d584c5790cf2a73611927ebc6c50a30a1b2acadf10f652aa59f4e093b2ab8a7fe175cb41c039c287c3d2966d2f4ac9904b
7
- data.tar.gz: 39abdd88f1351365fd75315a54997ee12547a7ccf2ff746928166693162fed9554f1208b65d077782134da6777aed6eab7970dbf7f7f1a8aa6d6228d9812091d
6
+ metadata.gz: f1c2b6291e26d91067214fc1747ba63a68f2d7f3a6c1ef92523505c22a7268f8cc54bcd45beebd25a9e68a03269c609857a66dff31b4bfa8f39195e56234e294
7
+ data.tar.gz: c49f90a02ebdaa545aa9f99fee351fcb6630030138b086d0c973017565b7a7c6c6b8164da0746d5c4b9b191110e707738854945571e2469100a9f1edc04c5f3c
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ activerecord-bitemporal-tablize (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activerecord-bitemporal (0.0.1)
10
+ activesupport (6.1.3.2)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ concurrent-ruby (1.1.8)
17
+ diff-lcs (1.3)
18
+ i18n (1.8.10)
19
+ concurrent-ruby (~> 1.0)
20
+ minitest (5.14.4)
21
+ rake (13.0.3)
22
+ rspec (3.8.0)
23
+ rspec-core (~> 3.8.0)
24
+ rspec-expectations (~> 3.8.0)
25
+ rspec-mocks (~> 3.8.0)
26
+ rspec-core (3.8.0)
27
+ rspec-support (~> 3.8.0)
28
+ rspec-expectations (3.8.1)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.8.0)
31
+ rspec-mocks (3.8.0)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.8.0)
34
+ rspec-support (3.8.0)
35
+ tzinfo (2.0.4)
36
+ concurrent-ruby (~> 1.0)
37
+ zeitwerk (2.4.2)
38
+
39
+ PLATFORMS
40
+ x86_64-linux
41
+
42
+ DEPENDENCIES
43
+ activerecord-bitemporal
44
+ activerecord-bitemporal-tablize!
45
+ activesupport
46
+ rake (~> 13.0)
47
+ rspec (~> 3.0)
48
+
49
+ BUNDLED WITH
50
+ 2.2.15
@@ -0,0 +1,2 @@
1
+ require 'activerecord/bitemporal/tablize'
2
+ require 'activerecord/bitemporal/bitemporalize/instance_methods'
@@ -0,0 +1,15 @@
1
+ module ActiveRecord
2
+ module Bitemporal
3
+ module Bitemporalize
4
+ module InstanceMethods
5
+ def history
6
+ self.class.ignore_valid_datetime.bitemporal_for(bitemporal_id).order(valid_from: :desc).tap do |records|
7
+ records.define_singleton_method(:print_table) do |*attributes|
8
+ print ActiveRecord::Bitemporal::Tablize.new(records: records, attributes: attributes).call
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module ActiveRecord
2
+ module Bitemporal
3
+ module StringHalfWidthSize
4
+ refine String do
5
+ # 半角換算のサイズ
6
+ def half_width_size
7
+ length + chars.reject(&:ascii_only?).length
8
+ end
9
+ end
10
+ end
11
+
12
+ end
13
+ end
@@ -1,8 +1,9 @@
1
- require_relative 'tablize/version'
2
- require 'lib/activerecord/bitemporal/tablize/string_half_width_size'
1
+ require 'activerecord/bitemporal/tablize/version'
2
+ require 'activerecord/bitemporal/string_half_width_size'
3
+ require 'active_support/all'
3
4
 
4
5
  class ActiveRecord::Bitemporal::Tablize
5
- using StringHalfWidthSize
6
+ using ActiveRecord::Bitemporal::StringHalfWidthSize
6
7
 
7
8
  attr :records, :result, :attributes
8
9
 
@@ -3,7 +3,7 @@
3
3
  module Activerecord
4
4
  module Bitemporal
5
5
  module Tablize
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bitemporal-tablize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - lighty
@@ -22,14 +22,16 @@ files:
22
22
  - ".gitignore"
23
23
  - ".rspec"
24
24
  - Gemfile
25
+ - Gemfile.lock
25
26
  - README.md
26
27
  - Rakefile
27
28
  - activerecord-bitemporal-tablize.gemspec
28
29
  - bin/console
29
30
  - bin/setup
30
- - lib/activerecord/bitemporal.rb
31
+ - lib/activerecord-bitemporal-tablize.rb
32
+ - lib/activerecord/bitemporal/bitemporalize/instance_methods.rb
33
+ - lib/activerecord/bitemporal/string_half_width_size.rb
31
34
  - lib/activerecord/bitemporal/tablize.rb
32
- - lib/activerecord/bitemporal/tablize/string_half_width_size.rb
33
35
  - lib/activerecord/bitemporal/tablize/version.rb
34
36
  homepage: https://github.com/lighty/activerecord-bitemporal-tablize
35
37
  licenses: []
@@ -1,11 +0,0 @@
1
- module ActiveRecord
2
- class Bitemporal
3
- def history
4
- self.class.ignore_valid_datetime.bitemporal_for(bitemporal_id).order(valid_from: :desc).tap do |records|
5
- records.define_singleton_method(:print_table) do |*attributes|
6
- print ActiveRecord::Bitemporal::Tablize.new(records: records, attributes: attributes).call
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,14 +0,0 @@
1
- module ActiveRecord
2
- module Bitemporal
3
- module Tablize
4
- module StringHalfWidthSize
5
- refine String do
6
- # 半角換算のサイズ
7
- def half_width_size
8
- length + chars.reject(&:ascii_only?).length
9
- end
10
- end
11
- end
12
- end
13
- end
14
- end