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.
- Loading branch information
Showing
9 changed files
with
86 additions
and
59 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
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
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
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