Module: Axn::Mountable::MountingStrategies::Axn

Extended by:
Axn
Includes:
Base
Included in:
Axn
Defined in:
lib/axn/mountable/mounting_strategies/axn.rb

Defined Under Namespace

Modules: DSL

Instance Method Summary collapse

Methods included from Base

#_should_raise_method_collision_error?, #define_namespace_methods, #key, #mount, #mount_method, #mount_to_namespace, #preprocess_kwargs, #strategy_specific_kwargs

Instance Method Details

#default_inherit_modeObject



10
# File 'lib/axn/mountable/mounting_strategies/axn.rb', line 10

def default_inherit_mode = :lifecycle

#mount_to_target(descriptor:, target:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/axn/mountable/mounting_strategies/axn.rb', line 27

def mount_to_target(descriptor:, target:)
  name = descriptor.name

  mount_method(target:, method_name: name) do |**kwargs|
    axn = descriptor.mounted_axn_for(target: self)
    axn.call(**kwargs)
  end

  mount_method(target:, method_name: "#{name}!") do |**kwargs|
    axn = descriptor.mounted_axn_for(target: self)
    axn.call!(**kwargs)
  end

  mount_method(target:, method_name: "#{name}_async") do |**kwargs|
    axn = descriptor.mounted_axn_for(target: self)
    axn.call_async(**kwargs)
  end
end