module ZooniverseData::Helpers::Base
Public Instance Methods
_new_location_from(result)
click to toggle source
# File lib/zooniverse_data/helpers/base.rb, line 49 def _new_location_from(result) result.respond_to?(:path) ? result.path : result end
customize(manifest: nil, entry: nil)
click to toggle source
# File lib/zooniverse_data/helpers/base.rb, line 11 def customize(manifest: nil, entry: nil) self.manifest = manifest self.entry = entry if entry.subject? customize_subject elsif entry.group? customize_group end end
customize_group()
click to toggle source
# File lib/zooniverse_data/helpers/base.rb, line 26 def customize_group end
customize_subject()
click to toggle source
# File lib/zooniverse_data/helpers/base.rb, line 22 def customize_subject end
each_location() { |key, location| ... }
click to toggle source
# File lib/zooniverse_data/helpers/base.rb, line 30 def each_location new_locations = { } entry.location.each_pair do |key, value| new_locations[key] = if value.is_a?(Array) value.collect do |location| _new_location_from yield(key, location) end else _new_location_from yield(key, value) end end set_location new_locations end
set_location(hash)
click to toggle source
# File lib/zooniverse_data/helpers/base.rb, line 45 def set_location(hash) entry.update :$set => { location: hash } end