Class: PaperTrail::Human::Core::BatchPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/paper_trail/human/core/batch_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ BatchPresenter

Returns a new instance of BatchPresenter.



7
8
9
10
# File 'lib/paper_trail/human/core/batch_presenter.rb', line 7

def initialize(configuration)
  @configuration = configuration
  @change_extractor = ChangeExtractor.new
end

Instance Method Details

#call(versions, only: nil, except: nil) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/paper_trail/human/core/batch_presenter.rb', line 12

def call(versions, only: nil, except: nil)
  versions_data = versions.map { |v| [v, @change_extractor.call(v)] }
  preloaded = preload_relations(versions_data)

  versions_data.map do |version, changes|
    format_version(version, changes, preloaded, only: only, except: except)
  end
end