Sha256: 265bc8bb49efb184fb45b50e16fb9f994816d3d9898b304bb49819b1e2c1af8d
Contents?: true
Size: 639 Bytes
Versions: 4
Compression:
Stored size: 639 Bytes
Contents
class G5Updatable::LocationsUpdater def initialize(locations) @locations = locations end def update @locations.each { |location| process(location) unless skip?(location) } end private def process(g5_location) location = Location.find_or_initialize_by(urn: urn_for(g5_location)) G5Updatable.location_parameters.each do |parameter| location.send("#{parameter}=", g5_location.send(parameter)) end location.save end def skip?(location) Location.exists?(urn: urn_for(location)) && !G5Updatable.update_locations end def urn_for(location) location.uid.to_s.split("/").last end end
Version data entries
4 entries across 4 versions & 1 rubygems