class Redmine::IssueChange

An IssueChange is a change in the history of an Issue, such as assigning it to a different user, or changing its state.

Public Instance Methods

to_s() click to toggle source

Provide a human-readable description of the change that this object represents.

# File lib/redmine/issue_change.rb, line 15
def to_s
  format '%s: %s => %s', name, old_value, new_value
end
with_statuses(issue_statuses) click to toggle source

Like to_s, but use a given map of IDs to human-readable statuses to provide more meaningful information.

# File lib/redmine/issue_change.rb, line 21
def with_statuses(issue_statuses)
  if name == 'status_id'
    format 'Status: %s => %s',
           find_issue_status(issue_statuses, old_value),
           find_issue_status(issue_statuses, new_value)
  else
    to_s
  end
end

Private Instance Methods

find_issue_status(issue_statuses, value) click to toggle source
# File lib/redmine/issue_change.rb, line 33
def find_issue_status(issue_statuses, value)
  issue_status = issue_statuses.find do |is|
    is.fetch('id').to_i == value.to_i
  end
  issue_status.fetch('name')
end