forked from rails/jbuilder
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix timestamp precision for Rails (#24)
When using the Oj encoder in Rails you may inadvertently not get send sub-second timing on Date and Times. This update changes the default Oj encoder to be in Rails mode that respects the `ActiveSupport::JSON::Encoding.time_precision` parameter if you are using Rails. If you have already set defaults for Oj those will not be changed.
- Loading branch information
Showing
15 changed files
with
135 additions
and
111 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
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,7 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rails", "~> 7.1.0" | ||
|
||
gemspec path: "../" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
require 'turbostreamer' | ||
|
||
dependency_tracker = false | ||
|
||
begin | ||
|
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
|
||
class TurboStreamer | ||
module Errors | ||
class MergeError < ::StandardError | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
require 'active_support/core_ext/array' | ||
class TurboStreamer::KeyFormatter | ||
def initialize(*args) | ||
@format = {} | ||
@cache = {} | ||
|
||
class TurboStreamer | ||
class KeyFormatter | ||
def initialize(*args) | ||
@format = {} | ||
@cache = {} | ||
|
||
options = args.extract_options! | ||
args.each do |name| | ||
@format[name] = [] | ||
end | ||
options.each do |name, paramaters| | ||
@format[name] = paramaters | ||
end | ||
options = args.extract_options! | ||
args.each do |name| | ||
@format[name] = [] | ||
end | ||
|
||
def initialize_copy(original) | ||
@cache = {} | ||
options.each do |name, paramaters| | ||
@format[name] = paramaters | ||
end | ||
end | ||
|
||
def initialize_copy(original) | ||
@cache = {} | ||
end | ||
|
||
def format(key) | ||
@cache[key] ||= @format.inject(key.to_s) do |result, args| | ||
func, args = args | ||
if ::Proc === func | ||
func.call result, *args | ||
else | ||
result.send func, *args | ||
end | ||
def format(key) | ||
@cache[key] ||= @format.inject(key.to_s) do |result, args| | ||
func, args = args | ||
if ::Proc === func | ||
func.call result, *args | ||
else | ||
result.send func, *args | ||
end | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
class TurboStreamer | ||
VERSION = '1.10.0' | ||
VERSION = '1.11.0' | ||
end |
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
Oops, something went wrong.