class NRSER::Types::Top

The top type is the universal type - all values are members.

@see en.wikipedia.org/wiki/Top_type

Constants

NAME

Public Class Methods

new() click to toggle source
Calls superclass method NRSER::Types::Type::new
# File lib/nrser/types/top.rb, line 31
def initialize
  super name: NAME

  # All types maybe *should* be frozen so they can be used as prop defaults,
  # but this is the first one I ran into in practice, so it's the first one
  # to freeze.
  freeze
end

Public Instance Methods

==(other) click to toggle source

{AnyType} instances are all equal.

@note

`other`'s class must be {AnyType} exactly - we make no assumptions
about anything that has subclasses {AnyType}.

@param [*] other

Object to compare to.

@return [Boolean]

`true` if `other#class` equals {AnyType}.
# File lib/nrser/types/top.rb, line 73
def == other
  other.class == Top
end
explain() click to toggle source
# File lib/nrser/types/top.rb, line 44
def explain
  'Top'
end
from_s(string) click to toggle source
# File lib/nrser/types/top.rb, line 56
def from_s string
  string
end
has_from_s?() click to toggle source
# File lib/nrser/types/top.rb, line 52
def has_from_s?
  true
end
symbolic() click to toggle source
# File lib/nrser/types/top.rb, line 48
def symbolic
  '*' # '⊤'
end
test?(value) click to toggle source
# File lib/nrser/types/top.rb, line 40
def test? value
  true
end