Class: Dry::Types::FnContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/types/fn_container.rb

Class Method Summary collapse

Class Method Details

.[](function_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
25
# File 'lib/dry/types/fn_container.rb', line 19

def self.[](function_name)
  if container.key?(function_name)
    container[function_name]
  else
    function_name
  end
end

.containerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
# File 'lib/dry/types/fn_container.rb', line 7

def self.container
  @container ||= Container.new
end

.register(function) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
# File 'lib/dry/types/fn_container.rb', line 12

def self.register(function)
  register_function_name = register_name(function)
  container.register(register_function_name, function) unless container.key?(register_function_name)
  register_function_name
end

.register_name(function) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
# File 'lib/dry/types/fn_container.rb', line 28

def self.register_name(function)
  "fn_#{function.object_id}"
end