Class: NRSER::Types::AnyType

Inherits:
Type show all
Defined in:
lib/nrser/types/any.rb

Overview

A type for anything - #test? always returns ‘true`.

Instance Method Summary collapse

Methods inherited from Type

#===, #builtin_inspect, #check, #check!, #from_data, #from_s, #has_from_data?, #has_from_s?, #has_to_data?, #initialize, #inspect, #intersection, #name, #not, #respond_to?, #test, #to_data, #to_s, #union, #xor

Constructor Details

This class inherits a constructor from NRSER::Types::Type

Instance Method Details

#==(other) ⇒ Boolean

Note:

‘other`’s class must be NRSER::Types::AnyType exactly - we make no assumptions about anything that has subclasses NRSER::Types::AnyType.

NRSER::Types::AnyType instances are all equal.

Parameters:

  • other (*)

    Object to compare to.

Returns:



26
27
28
# File 'lib/nrser/types/any.rb', line 26

def == other
  other.class == AnyType
end

#custom_from_s(string) ⇒ Object



12
# File 'lib/nrser/types/any.rb', line 12

def custom_from_s string; string; end

#explainObject



11
# File 'lib/nrser/types/any.rb', line 11

def explain; '*'; end

#test?(value) ⇒ Boolean

Returns:

  • (Boolean)


10
# File 'lib/nrser/types/any.rb', line 10

def test? value; true; end