Sha256: 559dcc4b8be4a53df6f1eafbf629cc6f1bae2a3462f217969027119beee6f6db
Contents?: true
Size: 1.03 KB
Versions: 9
Compression:
Stored size: 1.03 KB
Contents
module Finitio # # The MultiTuple type generator allows capturing information *facts* with # optional attributes. For instance, a Point type with an optional color # could be defined as follows: # # Point = { r: Length, theta: Angle, color :? Color } # # This class allows capturing those information types. Note that it is # actually syntactic sugar over union types: # # Point = { r: Length, theta: Angle } # | { r: Length, theta: Angle, color: Color } # # A Hash with Symbol as keys is used as concrete ruby representation for # multi tuples. The values map to the concrete representations of each # attribute type. The dress function is similar to the one of TupleType # but allows optional attributes to be omitted # class MultiTupleType < Type include HeadingBasedType include HashBasedType def default_name "{#{heading.to_name}}" end def suppremum(other) super(other, TupleType, MultiTupleType) end end # class MultiTupleType end # module Finitio
Version data entries
9 entries across 9 versions & 1 rubygems