-
Notifications
You must be signed in to change notification settings - Fork 0
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
82 changed files
with
1,374 additions
and
532 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 +1 @@ | ||
0.0.1 | ||
0.0.2 |
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 @@ | ||
%YAML 1.2 | ||
%TAG !i18n! https://www.w3.org/ns/i18n%23 | ||
--- | ||
"@context": | ||
"@vocab": http://example.com/ | ||
name: http://xmlns.com/foaf/0.1/name | ||
homepage: http://xmlns.com/foaf/0.1/homepage | ||
depiction: http://xmlns.com/foaf/0.1/depiction | ||
name: Gregg Kellogg | ||
homepage: https://greggkellogg.net/ | ||
depiction: http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8 | ||
lang: !i18n!en-US EN-US | ||
dir: !i18n!_ltr "Left to Right" | ||
langdir: !i18n!en-US_ltr "Left to Right US English" |
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,26 @@ | ||
%YAML 1.2 | ||
%TAG !xsd! http://www.w3.org/2001/XMLSchema%23 | ||
--- | ||
"@context": | ||
"@vocab": http://example.com/ | ||
name: http://xmlns.com/foaf/0.1/name | ||
homepage: http://xmlns.com/foaf/0.1/homepage | ||
depiction: http://xmlns.com/foaf/0.1/depiction | ||
name: Gregg Kellogg | ||
homepage: https://greggkellogg.net/ | ||
depiction: http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8 | ||
yint: 123 | ||
yfloat: 123.45 | ||
ystring: string | ||
ynull: null | ||
ybool: true | ||
ydate: 2022-08-08 | ||
ytime: 12:00:00 | ||
ydateTime: 2022-08-08T12:00:00.000 | ||
integer: !xsd!integer 123 | ||
decimal: !xsd!decimal 123.456 | ||
double: !xsd!double 123.456e78 | ||
bool: !xsd!boolean true | ||
date: !xsd!date "2022-08-08" | ||
time: !xsd!time "12:00:00.000" | ||
dateTime: !xsd!dateTime "2022-08-08T12:00:00.000" |
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 @@ | ||
%YAML 1.2 | ||
%TAG ! http://www.w3.org/2001/XMLSchema%23 | ||
--- | ||
"@context": | ||
"@vocab": http://xmlns.com/foaf/0.1/ | ||
name: !string Gregg Kellogg | ||
homepage: https://greggkellogg.net/ | ||
depiction: http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8 | ||
date: !date "2022-08-08" |
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,61 @@ | ||
# frozen_string_literal: true | ||
|
||
# Amazing Print extensions for Psych | ||
#------------------------------------------------------------------------------ | ||
module AmazingPrint | ||
module Psych | ||
def self.included(base) | ||
base.send :alias_method, :cast_without_psych, :cast | ||
base.send :alias_method, :cast, :cast_with_psych | ||
end | ||
|
||
# Add Psych Node names to the dispatcher pipeline. | ||
#------------------------------------------------------------------------------ | ||
def cast_with_psych(object, type) | ||
cast = cast_without_psych(object, type) | ||
if (defined?(::Psych::Nodes::Node) && object.is_a?(::Psych::Nodes::Node)) | ||
cast = :psych_node | ||
end | ||
cast | ||
end | ||
|
||
STYLES = %w(ANY BLOCK FLOW) #------------------------------------------------------------------------------ | ||
def awesome_psych_node(object) | ||
contents = [] | ||
contents << colorize(object.class.name.split('::').last, :class) | ||
contents << colorize("!<#{object.tag}>", :args) if object.tag | ||
contents << colorize("&#{object.anchor}", :args) if object.respond_to?(:anchor) && object.anchor | ||
contents << colorize("(implicit)", :args) if object.respond_to?(:implicit) && object.implicit | ||
contents << colorize("(implicit end)", :args) if object.respond_to?(:implicit_end) && object.implicit_end | ||
case object | ||
when ::Psych::Nodes::Stream | ||
contents << awesome_array(object.children) | ||
when ::Psych::Nodes::Document | ||
contents << colorize('%TAG(' + object.tag_directives.flatten.join(' ') + ')', :args) unless Array(object.tag_directives).empty? | ||
contents << colorize("version #{object.version.join('.')}", :args) if object.version | ||
contents << awesome_array(object.children) | ||
when ::Psych::Nodes::Sequence | ||
style = %w(ANY BLOCK FLOW)[object.style.to_i] | ||
contents << awesome_array(object.children) | ||
when ::Psych::Nodes::Mapping | ||
style = %w(ANY BLOCK FLOW)[object.style.to_i] | ||
contents << colorize(style, :args) if object.style | ||
contents << awesome_hash(object.children.each_slice(2).to_h) | ||
when ::Psych::Nodes::Scalar | ||
style = %w(ANY PLAIN SINGLE_QUOTED DOUBLE_QUOTED LITERAL FOLDED)[object.style.to_i] | ||
contents << colorize(style, :args) if object.style | ||
contents << colorize("(plain)", :args) if object.plain | ||
contents << colorize("(quoted)", :args) if object.quoted | ||
contents << awesome_simple(object.value.inspect, :variable) | ||
when ::Psych::Nodes::Alias | ||
# No children | ||
else | ||
"Unknown node type: #{object.inspect}" | ||
end | ||
|
||
contents.join(' ') | ||
end | ||
end | ||
end | ||
|
||
AmazingPrint::Formatter.include AmazingPrint::Psych |
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
Oops, something went wrong.