Class: ViewComponent::Storybook::MethodArgs::DryInitializerComponentConstructorArgs

Inherits:
ControlMethodArgs show all
Defined in:
lib/view_component/storybook/method_args/dry_initializer_component_constructor_args.rb

Overview

Class representing the constructor args for a Component the extends dry-initializer

Defined Under Namespace

Classes: DryConstructorParametersNames

Constant Summary collapse

INITIALIZE_METHOD =
:__dry_initializer_initialize__

Instance Attribute Summary

Attributes inherited from ControlMethodArgs

#param_prefix

Attributes inherited from MethodArgs

#args, #kwargs, #target_method, #target_method_params_names

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ControlMethodArgs

#call, #controls, #resolve_method_args, #with_param_prefix

Constructor Details

#initialize(component_class, *args, **kwargs) ⇒ DryInitializerComponentConstructorArgs

Returns a new instance of DryInitializerComponentConstructorArgs.



37
38
39
40
41
# File 'lib/view_component/storybook/method_args/dry_initializer_component_constructor_args.rb', line 37

def initialize(component_class, *args, **kwargs)
  super(component_class.instance_method(INITIALIZE_METHOD), *args, **kwargs)

  @target_method_params_names = DryConstructorParametersNames.new(component_class)
end

Class Method Details

.dry_initialize?(component_class) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/view_component/storybook/method_args/dry_initializer_component_constructor_args.rb', line 33

def self.dry_initialize?(component_class)
  component_class.private_method_defined?(INITIALIZE_METHOD)
end