vorpal 1.4.0 → 1.5.0

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: 1f49a200d7a039a41a37ec89fb7d34264132d8946e9ca1d6d48d4b1eff63bf84
4
- data.tar.gz: bd124780b9af0181fcf410cfefad8ba36bf8f65b57580341e23b9b46f4e6325d
3
+ metadata.gz: '02685786f294b0dcf78479b2ade552b98d9320f1a8f602d6669d909ede3d0ef8'
4
+ data.tar.gz: 157ed8b8f7615e36db88f657de43d111a6cfb97bb325cc3a22e3cb70d0260aa3
5
5
  SHA512:
6
- metadata.gz: ceee079b196c3152cc146446330d6ee747436c73f960439326c8fa6b51018b2c5aea167e4d2ffb5da6a5a4b0fa237941c1074886eec1e79502fd36c76847e3a0
7
- data.tar.gz: 4355d199f235bc789591adcb5371e5c28e697da34ca33106e5aa82353e039dc53268924bca24fbd8e6f07c1ea43474eeaccbde7d9d1c4d79ffaebedabbe8d5fc
6
+ metadata.gz: 3c54689a714716646cf4056dcc1a153d411397abd4700e4dc0b34182f6fd2b140da36c1dc6aaa03570d41fb1d6c7e12df53bf66a356a543ffbbbf157e66a9173
7
+ data.tar.gz: fb60dc70f5be204191726c6b9d3d2c5c6210cc3116fa4a21b4ceffeb7f601a68844132cc43e12dd7b61aa9edbc3936da495cbec1ed470b58cee68e18d466b10b
data/README.md CHANGED
@@ -52,7 +52,7 @@ class Branch
52
52
  attr_accessor :tree
53
53
  end
54
54
 
55
- class Gardener
55
+ class Gardener < ActiveRecord::Base
56
56
  end
57
57
 
58
58
  class Tree
@@ -65,7 +65,10 @@ module Vorpal
65
65
  # @param db_class [Class] A subclass of ActiveRecord::Base
66
66
  # @return [[Integer]] An array of unused primary keys.
67
67
  def get_primary_keys(db_class, count)
68
- result = execute("select nextval($1) from generate_series(1,$2);", [sequence_name(db_class), count])
68
+ result = execute("select nextval($1) from generate_series(1,$2);", [
69
+ ActiveRecord::Relation::QueryAttribute.new("sequence_name", sequence_name(db_class), ActiveRecord::Type::String.new),
70
+ ActiveRecord::Relation::QueryAttribute.new("count", count, ActiveRecord::Type::Integer.new)
71
+ ])
69
72
  result.rows.map(&:first).map(&:to_i)
70
73
  end
71
74
 
@@ -140,12 +143,11 @@ module Vorpal
140
143
  def sequence_name(db_class)
141
144
  @sequence_names[db_class] ||= execute(
142
145
  "SELECT substring(column_default from '''(.*)''') FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = $1 AND column_name = 'id' LIMIT 1",
143
- [db_class.table_name]
146
+ [ActiveRecord::Relation::QueryAttribute.new("table_name", db_class.table_name, ActiveRecord::Type::String.new)]
144
147
  ).rows.first.first
145
148
  end
146
149
 
147
150
  def execute(sql, binds)
148
- binds = binds.map { |row| [nil, row] }
149
151
  ActiveRecord::Base.connection.exec_query(sql, 'SQL', binds)
150
152
  end
151
153
  end
@@ -1,3 +1,3 @@
1
1
  module Vorpal
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vorpal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Kirby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-16 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_serializer