Module: ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Concern::InstanceMethods

Includes:
ConvenientService::Support::Delegate
Defined in:
lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConvenientService::Support::Concern

included

Instance Attribute Details

#callerObject (readonly)

Returns the value of attribute caller.



29
30
31
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 29

def caller
  @caller
end

#directionObject (readonly)

Returns the value of attribute direction.



35
36
37
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 35

def direction
  @direction
end

#keyObject (readonly)

Returns the value of attribute key.



17
18
19
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 17

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 23

def name
  @name
end

Instance Method Details

#==(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any object.

Returns:

  • (Boolean, nil)


132
133
134
135
136
137
138
139
140
141
142
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 132

def ==(other)
  return unless other.instance_of?(self.class)

  return false if key != other.key
  return false if name != other.name
  return false if caller != other.caller
  return false if direction != other.direction
  return false if organizer(raise_when_missing: false) != other.organizer(raise_when_missing: false)

  true
end

#define_output_in_container!(container, index:) ⇒ void

This method returns an undefined value.



120
121
122
123
124
125
126
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 120

def define_output_in_container!(container, index:)
  direction.define_output_in_container!(container, index: index, method: self)

  caller.define_output_in_container!(container, index: index, method: self)

  true
end

#has_organizer?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 79

def has_organizer?
  Utils.to_bool(organizer(raise_when_missing: false))
end

#initialize(key:, name:, caller:, direction:, organizer: nil) ⇒ void



50
51
52
53
54
55
56
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 50

def initialize(key:, name:, caller:, direction:, organizer: nil)
  @key = key
  @name = name
  @caller = caller
  @direction = direction
  @organizer = organizer
end

#organizer(raise_when_missing: true) ⇒ ConvenientService::Service?

Parameters:

  • raise_when_missing (Boolean) (defaults to: true)

Returns:

Raises:



63
64
65
66
67
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 63

def organizer(raise_when_missing: true)
  ::ConvenientService.raise Exceptions::MethodHasNoOrganizer.new(method: self) if @organizer.nil? && raise_when_missing

  @organizer
end

#reassignment?(name) ⇒ Boolean

Parameters:

  • name (Symbol, String)

Returns:

  • (Boolean)


87
88
89
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 87

def reassignment?(name)
  caller.reassignment?(name)
end

#to_argumentsConvenientService::Support::Arguments



154
155
156
157
158
159
160
161
162
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 154

def to_arguments
  Support::Arguments.new(
    key: key,
    name: name,
    caller: caller,
    direction: direction,
    organizer: organizer(raise_when_missing: false)
  )
end

#to_kwargsHash{Symbol => Object}

Returns:

  • (Hash{Symbol => Object})


147
148
149
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 147

def to_kwargs
  to_arguments.kwargs
end

#to_sString

Returns:

  • (String)


40
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 40

delegate :to_s, to: :name

#validate_as_input_for_container!(container) ⇒ void

This method returns an undefined value.



95
96
97
98
99
100
101
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 95

def validate_as_input_for_container!(container)
  direction.validate_as_input_for_container!(container, method: self)

  caller.validate_as_input_for_container!(container, method: self)

  true
end

#validate_as_output_for_container!(container) ⇒ void

This method returns an undefined value.



107
108
109
110
111
112
113
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 107

def validate_as_output_for_container!(container)
  direction.validate_as_output_for_container!(container, method: self)

  caller.validate_as_output_for_container!(container, method: self)

  true
end

#valueObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



72
73
74
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb', line 72

def value
  @value ||= caller.calculate_value(self)
end