Class: ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::If Private

Inherits:
Base
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb

Overview

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.

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#and?, #complex_if?, #else?, #empty?, #group?, #not?, #or?, #scalar?, #steps

Methods included from ConvenientService::Support::Copyable

#copy

Methods included from ConvenientService::Support::AbstractMethod

abstract_method

Methods included from ConvenientService::Support::Concern

included

Constructor Details

#initialize(condition_expression, then_expression) ⇒ void

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.



32
33
34
35
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 32

def initialize(condition_expression, then_expression)
  @condition_expression = condition_expression
  @then_expression = then_expression
end

Instance Attribute Details

#condition_expressionObject (readonly)

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.

Since:

  • 1.0.0



19
20
21
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 19

def condition_expression
  @condition_expression
end

#then_expressionObject (readonly)

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.

Since:

  • 1.0.0



25
26
27
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 25

def then_expression
  @then_expression
end

Instance Method Details

#==(other) ⇒ Boolean?

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.

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)

Since:

  • 1.0.0



128
129
130
131
132
133
134
135
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 128

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

  return false if condition_expression != other.condition_expression
  return false if then_expression != other.then_expression

  true
end

#each_evaluated_step(&block) ⇒ ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::Base

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.



94
95
96
97
98
99
100
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 94

def each_evaluated_step(&block)
  condition_expression.each_evaluated_step(&block)

  then_expression.each_evaluated_step(&block) if condition_expression.success?

  self
end

#each_step(&block) ⇒ ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::Base

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.



82
83
84
85
86
87
88
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 82

def each_step(&block)
  condition_expression.each_step(&block)

  then_expression.each_step(&block)

  self
end

#error?Boolean

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:

  • (Boolean)

Since:

  • 1.0.0



71
72
73
74
75
76
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 71

def error?
  return false if condition_expression.failure?
  return true if condition_expression.error?

  then_expression.error?
end

#failure?Boolean

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:

  • (Boolean)

Since:

  • 1.0.0



61
62
63
64
65
66
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 61

def failure?
  return true if condition_expression.failure?
  return false if condition_expression.error?

  then_expression.failure?
end

#if?Boolean

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:

  • (Boolean)

Since:

  • 1.0.0



120
121
122
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 120

def if?
  true
end

#inspectString

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:

  • (String)

Since:

  • 1.0.0



113
114
115
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 113

def inspect
  "if #{condition_expression.inspect} then #{then_expression.inspect} end"
end

#organizerConvenientService::Service

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:

Since:

  • 1.0.0



47
48
49
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 47

def organizer
  condition_expression.organizer
end

#resultConvenientService::Service::Plugins::HasJSendResult::Entities::Result

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.



40
41
42
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 40

def result
  condition_expression.success? ? then_expression.result : condition_expression.result
end

#success?Boolean

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:

  • (Boolean)

Since:

  • 1.0.0



54
55
56
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 54

def success?
  condition_expression.success? && then_expression.success?
end

#to_argumentsConvenientService::Support::Arguments

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:

Since:

  • 1.0.0



140
141
142
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 140

def to_arguments
  Support::Arguments.new(condition_expression, then_expression)
end

#with_organizer(organizer) ⇒ ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::Not

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.



106
107
108
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/if.rb', line 106

def with_organizer(organizer)
  copy(overrides: {args: {0 => condition_expression.with_organizer(organizer), 1 => then_expression.with_organizer(organizer)}})
end