Sha256: b2b63d8a7d9ac87ae8aa6d109fe68a7735afb74b9e85600f7dded8d08d121e2a

Contents?: true

Size: 458 Bytes

Versions: 1

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true

module TJSON
  class DataType
    # Boolean Value
    class Value < Scalar
      def tag
        "v"
      end

      def convert(value)
        raise TJSON::TypeError, "'null' is expressly disallowed in TJSON" if value.nil?
        raise TJSON::TypeError, "not a boolean value: #{value.inspect}" unless [true, false].include?(value)
        value
      end

      def generate(value)
        value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tjson-0.4.0 lib/tjson/datatype/value.rb