I have n-times similar statements
if trigger_data.tt_closed
unless trouble_ticket.changes.key?(:status)
@run = 0
break
end
unless trouble_ticket.changes[:status][1] == "Closed"
@run = 0
break
end
end
if trigger_data.tt_assignee
unless trouble_ticket.changes.key?(:assigned_to)
@run = 0
break
end
unless trouble_ticket.changes[:assigned_to][1] == trigger_data.tt_assignee
@run
break
end
end
How to refactoring that code? Maybe dynamic statement build with pass some hash to input. I'm newbie in metaprogramming. Give me advise please