occams-record 1.11.0 → 1.12.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: 18a298de4e4ba5a69fc0a6d1b3fb3faa2aa87fff6521b646a247276047a19881
4
- data.tar.gz: 01b292cfd25ab7343d817e58dfca09b5bf78f49a91ec3db7686dda5d83e840b5
3
+ metadata.gz: d4e051033114483887f29a642acfd83c92907d10f15ebac551cbbb61bcc73bf3
4
+ data.tar.gz: b14f0462cdf4b04c3264f40e9bad8ec11042f23abad2fa0933b16ea02ff03d44
5
5
  SHA512:
6
- metadata.gz: a403135e27531126a476472f8a8480598a1ed62c08657f6fa6541548d312a2d67707806620771d79ece5c8731f5f2b5e09e645676578b4018df69af0a1187437
7
- data.tar.gz: e154b22a69dd39051be5ef604f64ee9c86c80f9cf332cc1b26f6019ed2f599701f562f47537b39bc3c40433166200f554b819a949578f0c3acc483ab2ea1d847
6
+ metadata.gz: 2ccd9b91278ba7e95ba178ae786e17721d058c5f433b1594982fcd8e9e3c75c304d3bbe6a28f80ca543c71e53a0c053503f200a82083f2fe7d20e4072c99b86b
7
+ data.tar.gz: 575e5804b5d6a14f8f02c3afa1309310111a93bf77788d10b5e67d24bc67a88b072e9a2f9c25b31715a96bb47098066b47bbb5d9fceaf4c4da7cf0b0d4d2fc76
data/README.md CHANGED
@@ -8,6 +8,8 @@ Learn OccamsRecord by reading [The Book at occams.jordanhollinger.com](https://o
8
8
 
9
9
  API documentation is available at [rubydoc.info/gems/occams-record](http://www.rubydoc.info/gems/occams-record).
10
10
 
11
+ *Want OccamsRecord's flexible preloading in ActiveRecord itself? Check out [Uberloader](https://github.com/jhollinger/uberloader/)!*
12
+
11
13
  OccamsRecord is a high-efficiency, advanced query library for use alongside ActiveRecord. It is **not** an ORM or an ActiveRecord replacement. OccamsRecord can breathe fresh life into your ActiveRecord app by giving it two things:
12
14
 
13
15
  ### 1) Huge performance gains
@@ -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,5 +3,5 @@
3
3
  #
4
4
  module OccamsRecord
5
5
  # @private
6
- VERSION = "1.11.0".freeze
6
+ VERSION = "1.12.0".freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occams-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2024-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '7.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.2'
32
+ version: '7.3'
33
33
  description: A faster, lower-memory, fuller-featured querying API for ActiveRecord
34
34
  that returns results as unadorned, read-only objects.
35
35
  email: jordan.hollinger@gmail.com