mirror of
https://github.com/jimeh/go-render.git
synced 2026-02-19 03:16:39 +00:00
refactor: yet another one, someday I might be happy
This commit is contained in:
8
yaml.go
8
yaml.go
@@ -17,10 +17,10 @@ type YAML struct {
|
||||
var _ FormatRenderer = (*YAML)(nil)
|
||||
|
||||
// Render marshals the given value to YAML.
|
||||
func (j *YAML) Render(w io.Writer, v any) error {
|
||||
func (y *YAML) Render(w io.Writer, v any) error {
|
||||
enc := yaml.NewEncoder(w)
|
||||
|
||||
indent := j.Indent
|
||||
indent := y.Indent
|
||||
if indent == 0 {
|
||||
indent = 2
|
||||
}
|
||||
@@ -34,3 +34,7 @@ func (j *YAML) Render(w io.Writer, v any) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (y *YAML) Formats() []string {
|
||||
return []string{"yaml", "yml"}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user