Class: Tapioca::Compilers::MangroveResultExt Private

Inherits:
Dsl::Compiler
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/tapioca/dsl/compilers/mangrove_result_ext.rb

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

Constant Summary collapse

ConstantType =

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

type_member { { fixed: T.class_of(Mangrove::Result::Ext) } }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gather_constantsEnumerable<Module>

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.

Returns:

  • (Enumerable<Module>)


16
17
18
# File 'lib/tapioca/dsl/compilers/mangrove_result_ext.rb', line 16

def self.gather_constants
  all_classes.select { |c| c < ::Mangrove::Result::Ext }
end

Instance Method Details

#decoratevoid

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.

This method returns an undefined value.



21
22
23
24
25
26
27
28
29
30
# File 'lib/tapioca/dsl/compilers/mangrove_result_ext.rb', line 21

def decorate
  return unless valid_constant_name?(constant.to_s)

  root.create_path(constant) do |klass|
    klass.create_method("in_ok", return_type: "Mangrove::Result::Ok[#{constant}]")
    klass.create_method("in_err", return_type: "Mangrove::Result::Err[#{constant}]")
  end
rescue NameError
  # 握りつぶす
end