-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #513 from larskanis/less-require
Reduce the number of files loaded at `require 'pg'`
- Loading branch information
Showing
19 changed files
with
219 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- ruby -*- | ||
# frozen_string_literal: true | ||
|
||
require 'date' | ||
|
||
module PG | ||
module TextDecoder | ||
class Date < SimpleDecoder | ||
def decode(string, tuple=nil, field=nil) | ||
if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/ | ||
::Date.new $1.to_i, $2.to_i, $3.to_i | ||
else | ||
string | ||
end | ||
end | ||
end | ||
end | ||
end # module PG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- ruby -*- | ||
# frozen_string_literal: true | ||
|
||
module PG | ||
module TextDecoder | ||
# Init C part of the decoder | ||
init_inet | ||
end | ||
end # module PG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- ruby -*- | ||
# frozen_string_literal: true | ||
|
||
require 'json' | ||
|
||
module PG | ||
module TextDecoder | ||
class JSON < SimpleDecoder | ||
def decode(string, tuple=nil, field=nil) | ||
::JSON.parse(string, quirks_mode: true) | ||
end | ||
end | ||
end | ||
end # module PG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- ruby -*- | ||
# frozen_string_literal: true | ||
|
||
module PG | ||
module TextDecoder | ||
# Init C part of the decoder | ||
init_numeric | ||
end | ||
end # module PG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- ruby -*- | ||
# frozen_string_literal: true | ||
|
||
module PG | ||
module TextEncoder | ||
class Date < SimpleEncoder | ||
def encode(value) | ||
value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value | ||
end | ||
end | ||
end | ||
end # module PG |
Oops, something went wrong.