Class: LookbookVisualTester::UpdatePreviews

Inherits:
Service
  • Object
show all
Defined in:
lib/lookbook_visual_tester/update_previews.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(changes) ⇒ UpdatePreviews

Returns a new instance of UpdatePreviews.



7
8
9
10
# File 'lib/lookbook_visual_tester/update_previews.rb', line 7

def initialize(changes)
  @changes = changes[:modified]
  @changes_hash = changes
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



5
6
7
# File 'lib/lookbook_visual_tester/update_previews.rb', line 5

def changes
  @changes
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
# File 'lib/lookbook_visual_tester/update_previews.rb', line 17

def call
  Rails.logger.info "LookbookVisualTester: Processing changes for #{should_process?} #{selected_changes.inspect}, #{changes.inspect}"
  return unless should_process?

  process_changes
rescue StandardError => e
  Rails.logger.error "LookbookVisualTester: Error processing changes: #{e.message}"
  Rails.logger.error e.backtrace.join("\n")
end

#update_app_dataObject



12
13
14
15
# File 'lib/lookbook_visual_tester/update_previews.rb', line 12

def update_app_data
  LookbookVisualTester.data[:last_changed_files] = changes.presence || []
  LookbookVisualTester.data[:last_changed_previews] = selected_previews
end