occams-record 1.10.0 → 1.11.1

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: 13a3f1e39f767ad2eb6948e699d3be39a8018bba1be35260bbdd832c9f83d69f
4
- data.tar.gz: 8ef77becb090f5fdea847a707b2a99f5bc796f032632d9bdd4736a92e5a48e8a
3
+ metadata.gz: 59a1532b7b4de439a549008362dcc631ee79bfbd069c76a322e7df01c7f8d7f9
4
+ data.tar.gz: 765fe5f325d60a9d9830960be99028aa6215b166d9b2ef13bab84d074e9ede5c
5
5
  SHA512:
6
- metadata.gz: 3a45f3ca3fb2d3023a200712331b8d31eb9f4fa8b692cfd66434bccdc0eeac94e0dc0bfdcfd63db202a33501b2199eb916f255af59c35101f701db09c8dd53ed
7
- data.tar.gz: af48b818be6aa1fd1814db3bf45c80b62d0d65bacb547cfdd5383d0081245c29fe3469f26cdebbc9681b0c0954caccd8d1c87308852f3d4529cd29455edf7f5a
6
+ metadata.gz: d3a1bebbc0996c1b5b1efe59dfe2b47f14491b8a426eba7bea2e8269693ad7e0ff579c860bcf9031eb7c2ed18f7f4ce525c854d61d8444ed4505fd366fcb6050
7
+ data.tar.gz: a315b65a3a5c1750a09956ea9330c68b83d10bcd943cb9edf32fe94f47b54b9f9af016abb6f524f7567bd424c74d5cc661b836db6dbeb324e94f7f8222f444a5
@@ -13,8 +13,7 @@ module OccamsRecord
13
13
  #
14
14
  # Returns an Enumerator that yields batches of records, of size "of".
15
15
  # NOTE ActiveRecord 5+ provides the 'in_batches' method to do something
16
- # similiar, although 4.2 does not. Also it does not respect ORDER BY,
17
- # whereas this does.
16
+ # similiar, but unlike this it doesn't respect ORDER BY.
18
17
  #
19
18
  # @param batch_size [Integer] batch size
20
19
  # @param use_transaction [Boolean] Ensure it runs inside of a database transaction
@@ -1,33 +1,22 @@
1
1
  module OccamsRecord
2
2
  module BindsConverter
3
- # @private
4
- WORD = /\w/
5
-
6
3
  #
7
4
  # Converts Rails-style named binds (:foo) into native Ruby format (%{foo}).
8
5
  #
9
- class Named < Abstract
6
+ class Named
10
7
  def initialize(sql)
11
- super(sql, ":".freeze)
8
+ @sql = sql
12
9
  end
13
10
 
14
- protected
15
-
16
- def get_bind
17
- old_i = @i
18
- @i += 1
19
- @start_i = @i
20
-
21
- until @i > @end or @sql[@i] !~ WORD
22
- @i += 1
23
- end
24
-
25
- if @i > @start_i
26
- name = @sql[@start_i..@i - 1]
27
- @start_i = @i
28
- "%{#{name}}"
29
- else
30
- @sql[old_i]
11
+ def to_s
12
+ @sql.gsub(/([:\\]?):([a-zA-Z]\w*)/) do |match|
13
+ if $1 == ":".freeze # skip PostgreSQL casts
14
+ match # return the whole match
15
+ elsif $1 == "\\".freeze # escaped literal colon
16
+ match[1..-1] # return match with escaping backslash char removed
17
+ else
18
+ "%{#{$2}}"
19
+ end
31
20
  end
32
21
  end
33
22
  end
@@ -3,8 +3,7 @@ module OccamsRecord
3
3
  # @private
4
4
  CASTER =
5
5
  case ActiveRecord::VERSION::MAJOR
6
- when 4 then :type_cast_from_database
7
- when 5, 6, 7 then :deserialize
6
+ when 6, 7 then :deserialize
8
7
  else raise "OccamsRecord::TypeCaster::CASTER does yet support this version of ActiveRecord"
9
8
  end
10
9
 
@@ -3,5 +3,5 @@
3
3
  #
4
4
  module OccamsRecord
5
5
  # @private
6
- VERSION = "1.10.0".freeze
6
+ VERSION = "1.11.1".freeze
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occams-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '7.2'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '7.2'
@@ -84,14 +84,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - ">="
86
86
  - !ruby/object:Gem::Version
87
- version: 2.3.0
87
+ version: 3.0.0
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.1.6
94
+ rubygems_version: 3.4.19
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: The missing high-efficiency query API for ActiveRecord