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

Inherits:
Base
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.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?, #if?, #not?, #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(left_expression, right_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/or.rb', line 32

def initialize(left_expression, right_expression)
  @left_expression = left_expression
  @right_expression = right_expression
end

Instance Attribute Details

#left_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/or.rb', line 19

def left_expression
  @left_expression
end

#right_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/or.rb', line 25

def right_expression
  @right_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



142
143
144
145
146
147
148
149
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 142

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

  return false if left_expression != other.left_expression
  return false if right_expression != other.right_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.



105
106
107
108
109
110
111
112
113
114
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 105

def each_evaluated_step(&block)
  left_expression.each_evaluated_step(&block)

  return self if left_expression.success?
  return self if left_expression.error?

  right_expression.each_evaluated_step(&block)

  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.



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

def each_step(&block)
  left_expression.each_step(&block)
  right_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



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

def error?
  return false if left_expression.success?
  return true if left_expression.error?

  right_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



73
74
75
76
77
78
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 73

def failure?
  return false if left_expression.success?
  return false if left_expression.error?

  right_expression.failure?
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



127
128
129
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 127

def inspect
  "#{left_expression.inspect} || #{right_expression.inspect}"
end

#or?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



134
135
136
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 134

def or?
  true
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



50
51
52
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 50

def organizer
  left_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
43
44
45
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 40

def result
  return left_expression.result if left_expression.success?
  return left_expression.result if left_expression.error?

  right_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



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

def success?
  return true if left_expression.success?
  return false if left_expression.error?

  right_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



154
155
156
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb', line 154

def to_arguments
  Support::Arguments.new(left_expression, right_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.



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

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