ruby/blog/update_post.rb
# Called after parsing is finished to provide a summary of changes made.
# Returns nil if no changes were made.
Called after parsing is finished to provide a summary of changes made.
Returns nil if no changes were made.
Called after parsing is finished to provide a summary of changes made . Returns nil if no changes were made .
def update_message
    changes = @headlines - @existing_headlines
    result = changes.empty? ? '' : "#{changes.size} new/changed headlines"
    before = @existing_headlines & @headlines
    after = @headlines & @existing_headlines
    if before != after
      result += ', ' if not result.empty?
      result += 'existing headlines reordered'
    end
    return result.empty? ? nil : result
  end
def update_message changes = @headlines - @existing_headlines result = changes . empty? ? '' : "#{changes.size} new/changed headlines" before = @existing_headlines & @headlines after = @headlines & @existing_headlines if before != after result += ', ' if not result . empty? result += 'existing headlines reordered' end return result . empty? ? nil : result end
Called after parsing is finished to provide a summary of changes made.
Called after parsing is finished to provide a summary of changes made .