Class: ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::And
- Inherits:
-
Base
- Object
- Base
- ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::And
show all
- Defined in:
- lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#empty?, #group?, #not?, #or?, #scalar?, #steps
#copy
abstract_method
Constructor Details
#initialize(left_expression, right_expression) ⇒ void
27
28
29
30
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 27
def initialize(left_expression, right_expression)
@left_expression = left_expression
@right_expression = right_expression
end
|
Instance Attribute Details
#left_expression ⇒ Object
Returns the value of attribute left_expression.
14
15
16
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 14
def left_expression
@left_expression
end
|
#right_expression ⇒ Object
Returns the value of attribute right_expression.
20
21
22
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 20
def right_expression
@right_expression
end
|
Instance Method Details
#==(other) ⇒ Boolean?
115
116
117
118
119
120
121
122
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 115
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
|
#and? ⇒ Boolean
107
108
109
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 107
def and?
true
end
|
81
82
83
84
85
86
87
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 81
def each_evaluated_step(&block)
left_expression.each_evaluated_step(&block)
right_expression.each_evaluated_step(&block) if left_expression.success?
self
end
|
70
71
72
73
74
75
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 70
def each_step(&block)
left_expression.each_step(&block)
right_expression.each_step(&block)
self
end
|
#error? ⇒ Boolean
59
60
61
62
63
64
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 59
def error?
return false if left_expression.failure?
return true if left_expression.error?
right_expression.error?
end
|
#failure? ⇒ Boolean
49
50
51
52
53
54
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 49
def failure?
return true if left_expression.failure?
return false if left_expression.error?
right_expression.failure?
end
|
#inspect ⇒ String
100
101
102
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 100
def inspect
"#{left_expression.inspect} && #{right_expression.inspect}"
end
|
35
36
37
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 35
def result
left_expression.success? ? right_expression.result : left_expression.result
end
|
#success? ⇒ Boolean
42
43
44
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 42
def success?
left_expression.success? && right_expression.success?
end
|
127
128
129
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 127
def to_arguments
Support::Arguments.new(left_expression, right_expression)
end
|
93
94
95
|
# File 'lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb', line 93
def with_organizer(organizer)
copy(overrides: {args: {0 => left_expression.with_organizer(organizer), 1 => right_expression.with_organizer(organizer)}})
end
|