Module: Literal::Types
- Included in:
- Attributes, Model, Struct
- Defined in:
- lib/literal/types.rb
Defined Under Namespace
Modules: AnyType Classes: ArrayType, ClassType, EnumerableType, FloatType, HashType, IntegerType, InterfaceType, SetType, TupleType, UnionType
Constant Summary collapse
Instance Method Summary collapse
- #_Any ⇒ Object
- #_Array(type) ⇒ Object
- #_Boolean ⇒ Object
- #_Class(type) ⇒ Object
- #_Enumerable(type) ⇒ Object
- #_Float(range) ⇒ Object
- #_Hash(key_type, value_type) ⇒ Object
- #_Integer(range) ⇒ Object
- #_Interface(*methods) ⇒ Object
- #_Maybe(type) ⇒ Object
- #_Set(type) ⇒ Object
- #_Tuple(*types) ⇒ Object
- #_Union(*types) ⇒ Object
Instance Method Details
#_Array(type) ⇒ Object
7 8 9 |
# File 'lib/literal/types.rb', line 7 def _Array(type) Literal::Types::ArrayType.new(type) end |
#_Boolean ⇒ Object
36 37 38 |
# File 'lib/literal/types.rb', line 36 def _Boolean Literal::Types::BooleanType end |
#_Class(type) ⇒ Object
40 41 42 |
# File 'lib/literal/types.rb', line 40 def _Class(type) Literal::Types::ClassType.new(type) end |
#_Enumerable(type) ⇒ Object
15 16 17 |
# File 'lib/literal/types.rb', line 15 def _Enumerable(type) Literal::Types::EnumerableType.new(type) end |
#_Float(range) ⇒ Object
53 54 55 |
# File 'lib/literal/types.rb', line 53 def _Float(range) Literal::Types::FloatType.new(range) end |
#_Hash(key_type, value_type) ⇒ Object
19 20 21 |
# File 'lib/literal/types.rb', line 19 def _Hash(key_type, value_type) Literal::Types::HashType.new(key_type, value_type) end |
#_Integer(range) ⇒ Object
49 50 51 |
# File 'lib/literal/types.rb', line 49 def _Integer(range) Literal::Types::IntegerType.new(range) end |
#_Interface(*methods) ⇒ Object
23 24 25 26 |
# File 'lib/literal/types.rb', line 23 def _Interface(*methods) raise Literal::ArgumentError, "Interface type must have at least one method." if methods.size < 1 Literal::Types::InterfaceType.new(*methods) end |
#_Maybe(type) ⇒ Object
28 29 30 |
# File 'lib/literal/types.rb', line 28 def _Maybe(type) _Union(type, nil) end |
#_Set(type) ⇒ Object
11 12 13 |
# File 'lib/literal/types.rb', line 11 def _Set(type) Literal::Types::SetType.new(type) end |