Sha256: 615b04a157dd7ccf7e94530d23cef903c79bf3092aee13e2a6bc86c83e26180b
Contents?: true
Size: 783 Bytes
Versions: 1
Compression:
Stored size: 783 Bytes
Contents
# frozen_string_literal: true require_relative 'atomic_term' module MiniKraken module Core # A specialized atomic term that represents an boolean (true/false) value. # in MiniKraken class KBoolean < AtomicTerm # @param aValue [Boolean, Symbol] Ruby representation of boolean value def initialize(aValue) super(validated_value(aValue)) end def to_s value.to_s end private def validated_value(aValue) case aValue when true, false aValue when :"#t", '#t' true when :"#f", '#f' false else raise StandardError, "Invalid boolean literal '#{aValue}'" end end end # class end # module end # module
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mini_kraken-0.2.03 | lib/mini_kraken/core/k_boolean.rb |