mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-03 03:55:58 +01:00
avoid enum
prepare Scala 3
This commit is contained in:
@@ -78,7 +78,7 @@ object CommitState {
|
|||||||
|
|
||||||
val values: Vector[CommitState] = Vector(PENDING, SUCCESS, ERROR, FAILURE)
|
val values: Vector[CommitState] = Vector(PENDING, SUCCESS, ERROR, FAILURE)
|
||||||
|
|
||||||
private val map: Map[String, CommitState] = values.map(enum => enum.name -> enum).toMap
|
private val map: Map[String, CommitState] = values.map(e => e.name -> e).toMap
|
||||||
|
|
||||||
def apply(name: String): CommitState = map(name)
|
def apply(name: String): CommitState = map(name)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ object WebHookContentType {
|
|||||||
|
|
||||||
val values: Vector[WebHookContentType] = Vector(JSON, FORM)
|
val values: Vector[WebHookContentType] = Vector(JSON, FORM)
|
||||||
|
|
||||||
private val map: Map[String, WebHookContentType] = values.map(enum => enum.code -> enum).toMap
|
private val map: Map[String, WebHookContentType] = values.map(e => e.code -> e).toMap
|
||||||
|
|
||||||
def apply(code: String): WebHookContentType = map(code)
|
def apply(code: String): WebHookContentType = map(code)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user