Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/typed_attr/composite_type.rb
Direct Known Subclasses
Defined Under Namespace
Classes: CompositeType, ConjunctiveType, ContainerType, DisjunctiveType, NegativeType, PairType
Instance Method Summary collapse
-
#&(t) ⇒ Object
Constructs a type which must be A AND B.
-
#of(t) ⇒ Object
Constructs a type of Enumeration of an element type.
-
#with(t) ⇒ Object
Constructs a type of Pairs.
-
#|(t) ⇒ Object
Constructs a type which can be A OR B.
-
#~@ ⇒ Object
Constructs a type which must not be A.
Instance Method Details
#&(t) ⇒ Object
Constructs a type which must be A AND B.
Array.of(Positive&Integer)
71 72 73 |
# File 'lib/typed_attr/composite_type.rb', line 71 def & t ConjunctiveType.new(self, t) end |
#of(t) ⇒ Object
Constructs a type of Enumeration of an element type.
Array.of(String)
23 24 25 |
# File 'lib/typed_attr/composite_type.rb', line 23 def of t ContainerType.new(self, t) end |
#with(t) ⇒ Object
Constructs a type of Pairs.
Hash.of(String.with(Integer))
39 40 41 |
# File 'lib/typed_attr/composite_type.rb', line 39 def with t PairType.new(self, t) end |
#|(t) ⇒ Object
Constructs a type which can be A OR B.
Array.of(String|Integer)
55 56 57 |
# File 'lib/typed_attr/composite_type.rb', line 55 def | t DisjunctiveType.new(self, t) end |
#~@ ⇒ Object
Constructs a type which must not be A.
Array.of(~NilClass)
87 88 89 90 91 92 93 94 |
# File 'lib/typed_attr/composite_type.rb', line 87 def ~@ case self when NegativeType self._a else NegativeType.new(self) end end |