Sha256: 8d06803bc6d5ee47bfaa0e99ceff5a6fbabcaaa52307b48e676a9ca96aedb870

Contents?: true

Size: 971 Bytes

Versions: 10

Compression:

Stored size: 971 Bytes

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

  end # class MultiTupleType
end # module Finitio

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
finitio-0.7.0 lib/finitio/type/multi_tuple_type.rb
finitio-0.7.0.pre.rc4 lib/finitio/type/multi_tuple_type.rb
finitio-0.7.0.pre.rc3 lib/finitio/type/multi_tuple_type.rb
finitio-0.7.0.pre.rc2 lib/finitio/type/multi_tuple_type.rb
finitio-0.7.0.pre.rc1 lib/finitio/type/multi_tuple_type.rb
finitio-0.6.1 lib/finitio/type/multi_tuple_type.rb
finitio-0.6.0 lib/finitio/type/multi_tuple_type.rb
finitio-0.5.2 lib/finitio/type/multi_tuple_type.rb
finitio-0.5.1 lib/finitio/type/multi_tuple_type.rb
finitio-0.5.0 lib/finitio/type/multi_tuple_type.rb