Class: SteppedService::Base
- Inherits:
-
Object
- Object
- SteppedService::Base
show all
- Defined in:
- lib/stepped_service/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
87
88
89
|
# File 'lib/stepped_service/base.rb', line 87
def result
@result
end
|
Class Method Details
.call(*args, **keyword_args) ⇒ Object
89
90
91
|
# File 'lib/stepped_service/base.rb', line 89
def self.call(*args, **keyword_args)
new(*args, **keyword_args).call
end
|
Instance Method Details
#call ⇒ Object
You can override it, to not use steps
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/stepped_service/base.rb', line 94
def call
@finished = false
@failed = false
steps.each do |step|
send(step)
return self if finished? || failed?
end
finish!
self
end
|
#errors ⇒ Object
123
124
125
126
|
# File 'lib/stepped_service/base.rb', line 123
def errors
@errors ||= Errors.new
end
|
#failure? ⇒ Boolean
Also known as:
failed?
118
119
120
|
# File 'lib/stepped_service/base.rb', line 118
def failure?
failed == true
end
|
#finished? ⇒ Boolean
110
111
112
|
# File 'lib/stepped_service/base.rb', line 110
def finished?
finished == true
end
|
#steps ⇒ Object
106
107
108
|
# File 'lib/stepped_service/base.rb', line 106
def steps
%i[need to be implemented]
end
|
#success? ⇒ Boolean
114
115
116
|
# File 'lib/stepped_service/base.rb', line 114
def success?
!failure?
end
|