Class: Finitio::MultiTupleType
- Includes:
- HashBasedType, HeadingBasedType
- Defined in:
- lib/finitio/type/multi_tuple_type.rb
Overview
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
Constant Summary
Constants included from Metadata
Finitio::Metadata::EMPTY_METADATA
Instance Attribute Summary
Attributes included from HeadingBasedType
Instance Method Summary collapse
Methods included from HashBasedType
#dress, #generate_data, #include?, #representator, #to_json_schema
Methods included from HeadingBasedType
#==, #[], #hash, #initialize, #resolve_proxies, #unconstrained
Methods inherited from Type
#==, #anonymous?, #dress, #include?, #initialize, #name, #name=, #named?, #resolve_proxies, #to_s, #unconstrained
Methods included from Metadata
#metadata, #metadata=, #metadata?
Instance Method Details
#default_name ⇒ Object
24 25 26 |
# File 'lib/finitio/type/multi_tuple_type.rb', line 24 def default_name "{#{heading.to_name}}" end |
#suppremum(other) ⇒ Object
28 29 30 |
# File 'lib/finitio/type/multi_tuple_type.rb', line 28 def suppremum(other) super(other, TupleType, MultiTupleType) end |