Module: Steep::TypeConstruction::Types

Defined in:
lib/steep/type_construction.rb

Class Method Summary collapse

Class Method Details

.anyObject



6
7
8
# File 'lib/steep/type_construction.rb', line 6

def any
  AST::Types::Any.new
end

.array_instance(type) ⇒ Object



22
23
24
# File 'lib/steep/type_construction.rb', line 22

def array_instance(type)
  AST::Types::Name.new_instance(name: "::Array", args: [type])
end

.boolean?(type) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/steep/type_construction.rb', line 34

def boolean?(type)
  type == AST::Types::Name.new_interface(name: :_Boolean)
end

.hash_instance(key, value) ⇒ Object



26
27
28
# File 'lib/steep/type_construction.rb', line 26

def hash_instance(key, value)
  AST::Types::Name.new_instance(name: "::Hash", args: [key, value])
end

.nil_instanceObject



14
15
16
# File 'lib/steep/type_construction.rb', line 14

def nil_instance
  AST::Types::Name.new_instance(name: "::NilClass")
end

.range_instance(type) ⇒ Object



30
31
32
# File 'lib/steep/type_construction.rb', line 30

def range_instance(type)
  AST::Types::Name.new_instance(name: "::Range", args: [type])
end

.string_instanceObject



18
19
20
# File 'lib/steep/type_construction.rb', line 18

def string_instance
  AST::Types::Name.new_instance(name: "::String")
end

.symbol_instanceObject



10
11
12
# File 'lib/steep/type_construction.rb', line 10

def symbol_instance
  AST::Types::Name.new_instance(name: "::Symbol")
end