Class: Uinit::Sig::Method

Inherits:
Uinit::Struct
  • Object
show all
Includes:
Memoizable
Defined in:
lib/uinit/sig/method.rb

Instance Method Summary collapse

Instance Method Details

#for(method_name) ⇒ Object



35
36
37
38
39
# File 'lib/uinit/sig/method.rb', line 35

def for(method_name)
  self.method_name = method_name
  add_parameters_types
  MethodCompiler.compile(method: self)
end

#return_is!(value) ⇒ Object



41
42
43
44
45
# File 'lib/uinit/sig/method.rb', line 41

def return_is!(value)
  return_type.is!(value)
rescue Type::Error => e
  raise ReturnTypeError.new(self, e)
end

#returns(return_type) ⇒ Object



29
30
31
32
33
# File 'lib/uinit/sig/method.rb', line 29

def returns(return_type)
  self.return_type = return_type

  self
end