ParseableBoolean

com.phasmidsoftware.gryphon.parse.Parseable.ParseableBoolean
See theParseableBoolean companion object
trait ParseableBoolean extends Parseable[Boolean]

A trait that provides an implementation of the Parseable typeclass for the Boolean type.

This trait defines a mechanism for parsing string representations of boolean values ("true" or "false") into corresponding Boolean objects. If the input string can be successfully converted into a boolean, the result is wrapped in Some. Otherwise, the result is None.

The parsing relies on the standard library method toBooleanOption to perform the string conversion, which is case-sensitive and adheres strictly to "true" and "false".

Attributes

Companion
object
Graph
Supertypes
trait Parseable[Boolean]
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

def message: String

Provides a message describing the type supported by this implementation.

Provides a message describing the type supported by this implementation.

Attributes

Returns

A string representation of the type, in this case "Boolean".

def none: Boolean

Returns a default value of type T.

Returns a default value of type T.

Attributes

Returns

the default value of type T, typically representing an "empty" or "none" state.

def parse(w: String): Try[Boolean]

Parses the input string into an Option[Boolean] based on its content. The method interprets the string as a boolean value ("true" or "false") and returns it as an Option. If the string cannot be interpreted as a valid boolean, the method returns None.

Parses the input string into an Option[Boolean] based on its content. The method interprets the string as a boolean value ("true" or "false") and returns it as an Option. If the string cannot be interpreted as a valid boolean, the method returns None.

Value parameters

w

The input string to parse into a boolean value.

Attributes

Returns

An Option[Boolean] containing Some(true) or Some(false) if parsing is successful, or None if the string is not a valid representation of a boolean.

def regex: Regex

The regular expression used for parsing a Parseable[T].

The regular expression used for parsing a Parseable[T].

Attributes

Returns

A compiled regular expression. By default, the result matches one or more word characters (\w+).