module Railjet::UseCase
Attributes
context[R]
Public Class Methods
new(context)
click to toggle source
# File lib/railjet/use_case.rb, line 9 def initialize(context) @context = context end
Public Instance Methods
check_ability!(*args)
click to toggle source
# File lib/railjet/use_case.rb, line 36 def check_ability!(*args) true end
check_policy!(*args)
click to toggle source
# File lib/railjet/use_case.rb, line 40 def check_policy!(*args) true end
with_ability_check(*args) { || ... }
click to toggle source
# File lib/railjet/use_case.rb, line 21 def with_ability_check(*args) if check_ability!(*args) yield if block_given? else raise Railjet::UnauthorizedError end end
with_policy_check(*args) { || ... }
click to toggle source
# File lib/railjet/use_case.rb, line 29 def with_policy_check(*args) check_policy!(*args) yield if block_given? rescue Railjet::PolicyError => e raise Railjet::PolicyNotMetError.new(e.errors) end
with_requirements_check(*args) { || ... }
click to toggle source
# File lib/railjet/use_case.rb, line 13 def with_requirements_check(*args) with_ability_check(*args) do with_policy_check(*args) do yield if block_given? end end end