class ZooniverseData::Projects::HiggsHunter

Public Instance Methods

customize_subject() click to toggle source
# File lib/zooniverse_data/projects/higgs_hunter.rb, line 6
def customize_subject
  new_locations = default_empty_locations
  entry.location['standard'].each do |image_path|
    standard_image = standard_image(image_path)
    new_locations['standard'] << standard_image
    thumbnail_image = converter_for(standard_image, type: 'thumbnail', max_size: 400)
    new_locations['thumbnail'] << thumbnail_image
  end
  set_location new_locations
end

Private Instance Methods

converter_for(path, type: nil, max_size: nil) click to toggle source
# File lib/zooniverse_data/projects/higgs_hunter.rb, line 25
def converter_for(path, type: nil, max_size: nil)
  convert_image(path, remove_original: false)
    .resize(width: max_size, height: max_size, force: false)
    .quality(80)
    .write_to(prefix: type)
    .path
end
default_empty_locations() click to toggle source
# File lib/zooniverse_data/projects/higgs_hunter.rb, line 34
def default_empty_locations
  {
    'standard' => [],
    'thumbnail' => []
  }
end
standard_image(path) click to toggle source
# File lib/zooniverse_data/projects/higgs_hunter.rb, line 19
def standard_image(path)
  convert_image(path)
    .write_to(prefix: 'standard')
    .path
end