Class: Yoda::Model::FunctionSignatures::Wrapper

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/yoda/model/function_signatures/wrapper.rb

Overview

Wrap FunctionSignature::Base and allow it access to environment. TODO: Merge this with connected store

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment:, signature:) ⇒ Wrapper

Returns a new instance of Wrapper.

Parameters:

  • environment (Environment)
  • signature (FunctionSignature::Base)


21
22
23
24
# File 'lib/yoda/model/function_signatures/wrapper.rb', line 21

def initialize(environment:, signature:)
  @environment = environment
  @signature = signature
end

Instance Attribute Details

#environmentEnvironment (readonly)

Returns:



12
13
14
# File 'lib/yoda/model/function_signatures/wrapper.rb', line 12

def environment
  @environment
end

#signatureFunctionSignature::Base (readonly)

Returns:

  • (FunctionSignature::Base)


15
16
17
# File 'lib/yoda/model/function_signatures/wrapper.rb', line 15

def signature
  @signature
end

Instance Method Details

#rbs_typeRBS::MethodType

Parameters:

Returns:

  • (RBS::MethodType)


28
29
30
# File 'lib/yoda/model/function_signatures/wrapper.rb', line 28

def rbs_type
  signature.rbs_type(environment)
end

#to_s(include_namespace: false) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/yoda/model/function_signatures/wrapper.rb', line 32

def to_s(include_namespace: false)
  if include_namespace
    "#{namespace_path}#{sep}#{name}#{rbs_type.to_s}"
  else
    "#{name}#{rbs_type.to_s}"
  end
end

#wrapper(env) ⇒ Object



40
41
42
# File 'lib/yoda/model/function_signatures/wrapper.rb', line 40

def wrapper(env)
  Wrapper.new(environment: env, signature: signature)
end