summaryrefslogtreecommitdiff
path: root/support/texplate/source/main/kotlin/org/islandoftex/texplate/model/handlers/BooleanHandler.kt
blob: cbb74a532f99cab0cf81138cf9572ce7d393d758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// SPDX-License-Identifier: BSD-3-Clause
package org.islandoftex.texplate.model.handlers

/**
 * Implements a boolean handler.
 *
 * @version 1.0
 * @since 1.0
 */
class BooleanHandler : Handler {
    /**
     * Applies the conversion to the string.
     *
     * @param string The string.
     * @return A list.
     */
    override fun apply(string: String?): Any? {
        return listOf("true", "1", "yes").contains(string!!.toLowerCase())
    }
}