Class: ProblemDestroy

Inherits:
Object
  • Object
show all
Defined in:
app/interactors/problem_destroy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(problem) ⇒ ProblemDestroy


5
6
7
# File 'app/interactors/problem_destroy.rb', line 5

def initialize(problem)
  @problem = problem
end

Instance Attribute Details

#problemObject (readonly)

Returns the value of attribute problem


3
4
5
# File 'app/interactors/problem_destroy.rb', line 3

def problem
  @problem
end

Class Method Details

.execute(problems) ⇒ Integer

Destroy all problem pass in args


23
24
25
26
27
# File 'app/interactors/problem_destroy.rb', line 23

def self.execute(problems)
  Array(problems).each{ |problem|
    ProblemDestroy.new(problem).execute
  }.count
end

Instance Method Details

#executeObject


9
10
11
12
13
# File 'app/interactors/problem_destroy.rb', line 9

def execute
  delete_errs
  delete_comments
  problem.delete
end