Skip to content

Commit

Permalink
fixed my mess
Browse files Browse the repository at this point in the history
  • Loading branch information
lbialy committed May 10, 2024
1 parent cb17bb2 commit e140444
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object YamlEncoder extends YamlEncoderCrossCompanionCompat {
implicit def forBoolean: YamlEncoder[Boolean] = v => Node.ScalarNode(v.toString)
implicit def forString: YamlEncoder[String] = v => Node.ScalarNode(v)

given [T](using encoder: YamlEncoder[T]): YamlEncoder[Option[T]] = {
implicit def forOption[T](implicit encoder: YamlEncoder[T]): YamlEncoder[Option[T]] = {
case Some(t) => encoder.asNode(t)
case None => Node.ScalarNode("", Tag.nullTag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scala.collection.mutable
import org.virtuslab.yaml.Range
import org.virtuslab.yaml.Tag
import org.virtuslab.yaml.internal.load.parse.EventKind
import org.virtuslab.yaml.internal.load.parse.EventKind.*
import org.virtuslab.yaml.internal.load.parse.EventKind._
import org.virtuslab.yaml.internal.load.parse.NodeEventMetadata

object PresenterImpl extends Presenter {
Expand All @@ -33,7 +33,7 @@ object PresenterImpl extends Presenter {
case Scalar(value, _, NodeEventMetadata(_, tag)) =>
insertSequencePadding()
// todo escape string using doublequotes
if tag.contains(Tag.nullTag) then sb.append("!!null")
if (tag.contains(Tag.nullTag)) sb.append("!!null")
else sb.append(value)
sb.append(newline)
tail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.virtuslab.yaml.internal.dump.serialize
import org.virtuslab.yaml.Node
import org.virtuslab.yaml.Range
import org.virtuslab.yaml.internal.load.parse.EventKind
import org.virtuslab.yaml.internal.load.parse.EventKind.*
import org.virtuslab.yaml.internal.load.parse.EventKind._
import org.virtuslab.yaml.internal.load.parse.NodeEventMetadata

object SerializerImpl extends Serializer {
Expand Down
171 changes: 0 additions & 171 deletions core/shared/src/test/scala/org/virtuslab/yaml/YamlEncoderSuite.scala

This file was deleted.

0 comments on commit e140444

Please sign in to comment.