Sha256: f4e7b5b6b8c09638589e31046ab04c6cceee658a851ee9238234449709d13d95

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

require_relative 'atomic_term'

module MiniKraken
  module Atomic
    # A specialized atomic term that represents a symbolic value
    # in MiniKraken.
    class KSymbol < AtomicTerm
      # Initialize a MiniKraken symbol with a given Ruby Symbol value.
      # @param aValue [Symbol] Ruby representation of symbol value
      def initialize(aValue)
        super(aValue)
      end

      # Returns the name or string corresponding to value.
      # @return [String]
      def id2name
        value.id2name
      end

      # Returns a string representing the MiniKraken symbol.
      # @return [String]
      def to_s
        ":#{id2name}"
      end
    end # class
  end # module
end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mini_kraken-0.2.04 lib/mini_kraken/atomic/k_symbol.rb