Class: Users::ShowUser
- Inherits:
-
BaseUseCase
- Object
- BaseUseCase
- Users::ShowUser
- Defined in:
- lib/winewoo_core/use_cases/users/show_user.rb
Instance Method Summary collapse
- #call(user_id) {|user ? UseCaseResults.found(user) : UseCaseResults.not_found| ... } ⇒ Object
-
#initialize(current_user, log_params = nil) ⇒ ShowUser
constructor
A new instance of ShowUser.
Constructor Details
#initialize(current_user, log_params = nil) ⇒ ShowUser
Returns a new instance of ShowUser.
4 5 6 7 |
# File 'lib/winewoo_core/use_cases/users/show_user.rb', line 4 def initialize(current_user, log_params=nil) super(WinewooCore.users_repo.new, log_params) self.current_caller = current_user end |
Instance Method Details
#call(user_id) {|user ? UseCaseResults.found(user) : UseCaseResults.not_found| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/winewoo_core/use_cases/users/show_user.rb', line 10 def call(user_id) user = (user_id == 'me') ? self.current_caller : self.repo.get(user_id) return unless (user, &Proc.new) yield user ? UseCaseResults.found(user) : UseCaseResults.not_found end |