Class: Clarc::UseCaseBase
- Inherits:
-
Object
- Object
- Clarc::UseCaseBase
show all
- Defined in:
- lib/clarc/use_case_base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(request) ⇒ UseCaseBase
Returns a new instance of UseCaseBase.
3
4
5
|
# File 'lib/clarc/use_case_base.rb', line 3
def initialize request
@request = request
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/clarc/use_case_base.rb', line 13
def method_missing name, *args, &block
return super unless block_given? && args.empty?
@blocks ||= {}
@blocks[name.to_sym] = block
end
|
Instance Method Details
7
8
9
10
11
|
# File 'lib/clarc/use_case_base.rb', line 7
def perform &block
block.call(self, response)
@blocks[response.status].call
response
end
|
#response ⇒ Object
20
21
22
23
|
# File 'lib/clarc/use_case_base.rb', line 20
def response
main if @response.nil?
@response
end
|