Class: Wlog::DeleteIssue
- Inherits:
-
Object
- Object
- Wlog::DeleteIssue
- Defined in:
- lib/wlog/commands/delete_issue.rb
Overview
Instance Attribute Summary collapse
-
#deleted ⇒ Object
readonly
Returns the value of attribute deleted.
Instance Method Summary collapse
- #deleted? ⇒ Boolean
-
#execute ⇒ Object
delete the issue.
-
#initialize(id) ⇒ DeleteIssue
constructor
Init with the issue id.
Constructor Details
#initialize(id) ⇒ DeleteIssue
Init with the issue id
9 10 11 12 |
# File 'lib/wlog/commands/delete_issue.rb', line 9 def initialize(id) @issue_id = id @deleted = false end |
Instance Attribute Details
#deleted ⇒ Object (readonly)
Returns the value of attribute deleted.
29 30 31 |
# File 'lib/wlog/commands/delete_issue.rb', line 29 def deleted @deleted end |
Instance Method Details
#deleted? ⇒ Boolean
25 26 27 |
# File 'lib/wlog/commands/delete_issue.rb', line 25 def deleted? @deleted end |
#execute ⇒ Object
delete the issue
15 16 17 18 19 20 21 22 23 |
# File 'lib/wlog/commands/delete_issue.rb', line 15 def execute issue = Issue.find(@issue_id) if issue issue.destroy @deleted = true end rescue ActiveRecord::RecordNotFound @deleted = false end |