active_record_mysql_repl 0.1.6 → 0.1.7

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: 489b4d821f8cf40519a68467b478bd1d0513645a339f857db3c5c8115283fb02
4
- data.tar.gz: b9b213e37f4f8b33a23e4f2fc0fefc5eb4efe7e973f183ab8f38802aeb1df3bf
3
+ metadata.gz: 7893476abc10750ae8de2108f440da50b8a7082555bf04347bdaaeb2d92818a9
4
+ data.tar.gz: bfd86689e58838c910471ba54382724f810255c865edb7f2bdfc43827ecfbc99
5
5
  SHA512:
6
- metadata.gz: 12f4ae422a58cdbcb9464a4599564b08e51bb5ab31ac129b7a84ab97850e9ec52ebec7c1b0aa4eedc549e2a25e08666a1507f20da33bae47af7943d493a8dade
7
- data.tar.gz: 1a289dd4aa4b8a15b8e851bfee7838fd1479a3116969d1a3a5d19b034a3d5674d64b224c3f6add66953b44b764106defee225e1f73ca62774f520a02e494c0f5
6
+ metadata.gz: e234c07ac4b8694e1ad8455b595fff7b20e99193d0ec417cf00a7a0b243e482ee7f01dc46c971ec6a68846d4bd8ef5d2d1080f1a5f39274d4e39c395fa598515
7
+ data.tar.gz: d6b382c634f63e326499eaeaec189f77fe9496a17c019c83eca21e0806f197f2e3a115315c34ddc88649e5457195ce9d4737bd78dd4b8114e49ac06784e05f0f
data/README.md CHANGED
@@ -624,6 +624,77 @@ D, [2024-12-11T23:48:57.250492 #96381] DEBUG -- : Order Load (1.8ms) SELECT `
624
624
 
625
625
  </details>
626
626
 
627
+ Convenient syntax sugar such as `'value'.{table_name}` `'value'.{table_name}s` `'value'.{table_name}_by_{column_name}` are available as dynamically defined methods.
628
+
629
+ ```rb
630
+ [1] test(main)> :'1'.order
631
+ ```
632
+
633
+ <details><summary>output:</summary>
634
+
635
+ ```rb
636
+ D, [2024-12-13T11:40:17.290699 #48059] DEBUG -- : Order Load (2.2ms) SELECT `orders`.* FROM `orders` WHERE `orders`.`id` = '1' LIMIT 1
637
+ #<Order:0x0000000122e7f0e0> {
638
+ :id => "1",
639
+ :user_id => "1",
640
+ :item_id => "1"
641
+ }
642
+ ```
643
+
644
+ </details>
645
+
646
+ ```rb
647
+ [2] test(main)> '1'.order
648
+ ```
649
+
650
+ <details><summary>output:</summary>
651
+
652
+ ```rb
653
+ D, [2024-12-13T11:40:21.217724 #48059] DEBUG -- : Order Load (2.4ms) SELECT `orders`.* FROM `orders` WHERE `orders`.`id` = '1' LIMIT 1
654
+ #<Order:0x000000010512c450> {
655
+ :id => "1",
656
+ :user_id => "1",
657
+ :item_id => "1"
658
+ }
659
+ ```
660
+
661
+ </details>
662
+
663
+ ```rb
664
+ [3] test(main)> '1'.orders
665
+ ```
666
+
667
+ <details><summary>output:</summary>
668
+
669
+ ```rb
670
+ D, [2024-12-13T11:40:22.781925 #48059] DEBUG -- : Order Load (2.7ms) SELECT `orders`.* FROM `orders` WHERE `orders`.`id` = '1' LIMIT 1
671
+ #<Order:0x0000000105129750> {
672
+ :id => "1",
673
+ :user_id => "1",
674
+ :item_id => "1"
675
+ }
676
+ ```
677
+
678
+ </details>
679
+
680
+ ```rb
681
+ [4] test(main)> '1'.user_by_profile_id
682
+ ```
683
+
684
+ <details><summary>output:</summary>
685
+
686
+ ```rb
687
+ D, [2024-12-13T11:40:47.497002 #48059] DEBUG -- : User Load (7.9ms) SELECT `users`.* FROM `users` WHERE `users`.`profile_id` = 1
688
+ [
689
+ [0] #<User:0x00000001243fc0f8> {
690
+ :id => "1",
691
+ :login_id => "login_id1",
692
+ :profile_id => 1
693
+ }
694
+ ]
695
+ ```
696
+
697
+ </details>
627
698
  ---
628
699
 
629
700
  `.csv(orientation)` is defined to generate csv format. The default orientation is same as `.tab`.
@@ -6,7 +6,7 @@ module ActiveRecordMysqlRepl
6
6
  attr_reader :configs
7
7
 
8
8
  def self.load(path)
9
- new(YAML.load_file(path))
9
+ new(YAML.load_file(path, aliases: true))
10
10
  end
11
11
 
12
12
  def [](key)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordMysqlRepl
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_mysql_repl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroki Kishi