Sha256: 2ea0cbcc222ecd1bda9c6228eece472931ddd86dfa07fc56ecf6a9c7e01ae574

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

require 'singleton' # Use the Singleton design pattern
require_relative 'boolean'

module Loxxy
  module Datatype
    # Class for representing a Lox true value.
    class True < Boolean
      include Singleton # Make a singleton class

      # Build the sole instance
      def initialize
        super(true)
      end

      # Is this object representing the true value in Lox?
      # @return [TrueClass]
      def true?
        true
      end
    end # class

    True.instance.freeze # Make the sole instance immutable
  end # module
end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loxxy-0.0.15 lib/loxxy/datatype/true.rb
loxxy-0.0.14 lib/loxxy/datatype/true.rb