Class: Typisch::Type::Date

Inherits:
Constructor::Singleton show all
Defined in:
lib/typisch/datetime.rb

Constant Summary collapse

VALID_IMPLEMENTATION_CLASSES =

You could add your own to the list, if you have some alternative ruby implementation with a Date-like interface which you want to typecheck.

[::Date]

Constants inherited from Constructor

Constructor::CONSTRUCTOR_TYPE_SUBCLASSES

Instance Attribute Summary

Attributes inherited from Typisch::Type

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Constructor::Singleton

check_subtype, #subexpression_types, #tag, #to_s, top_type

Methods inherited from Constructor

#alternative_types, check_subtype, #check_type, inherited, #tag, top_type, #type_lattice

Methods inherited from Typisch::Type

#<, #<=, #<=>, #==, #===, #>, #>=, #alternative_types, #annotations, #annotations=, #canonicalize!, #excluding_null, #inspect, #recursive?, #subexpression_types, subtype?, #target, #to_s, #to_string

Class Method Details

.tagObject



6
# File 'lib/typisch/datetime.rb', line 6

def self.tag; "Date"; end

Instance Method Details

#shallow_check_type(instance) ⇒ Object



13
14
15
# File 'lib/typisch/datetime.rb', line 13

def shallow_check_type(instance)
  case instance when *VALID_IMPLEMENTATION_CLASSES then true else false end
end