require "forwardable"

class SectionViewAdapter < SimpleDelegator
  extend ActiveModel::Naming
  include ActiveModel::Conversion

  def initialize(manual, document)
    @manual = manual
    @document = document
    super(document)
  end

  def persisted?
    document.updated_at || document.published?
  end

  def minor_update
    document.draft? ? document.minor_update : false
  end

  def change_note
    document.draft? ? document.change_note : ""
  end

  def to_param
    document.id
  end

  def self.model_name
    ActiveModel::Name.new(self, nil, "Document")
  end

private

  attr_reader :manual, :document
end

require "forwardable"

class SectionViewAdapter < SimpleDelegator
  extend ActiveModel::Naming
  include ActiveModel::Conversion

  def initialize(manual, section)
    @manual = manual
    @section = section
    super(section)
  end

  def persisted?
    section.updated_at || section.published?
  end

  def minor_update
    section.draft? ? section.minor_update : false
  end

  def change_note
    section.draft? ? section.change_note : ""
  end

  def to_param
    section.id
  end

  def self.model_name
    ActiveModel::Name.new(self, nil, "Document")
  end

private

  attr_reader :manual, :section
end

Rename instance variable `document` -> `section`
Rename instance variable `document` -> `section`
