Sha256: f90aaeb46071a4e4355466ba4623b49f8619eef9d3551f25ae5ce99eae995cf3
Contents?: true
Size: 931 Bytes
Versions: 26
Compression:
Stored size: 931 Bytes
Contents
class Eco::API::UseCases::DefaultCases::CleanUnknownTags < Eco::API::Common::Loaders::UseCase name "clean-unknown-tags" type :transform REGISTER_TAGS = [ "EVENT", "INJURY", "RISK", "CONTRACTOR", "PERMIT", "AUDIT", "JSEA", "TRAINING", "INDUCTION", "MEETING", "PPE", "CHEMICAL", "PLANT", "ASSET", "POLICY", "IDEA", "REPORTS" ] attr_reader :session, :options def main(people, session, options, usecase) @session = session; @options = options update = session.new_job("main", "update", :update, usecase) people.each do |person| unknown_tags = person.filter_tags.select {|tag| !tag?(tag)} person.filter_tags -= unknown_tags update.add(person) end end private def tag?(value) tagtree.tag?(value) || REGISTER_TAGS.any? {|reg| value == reg} end def tagtree @tagtree ||= ASSETS.config.tagtree end end
Version data entries
26 entries across 26 versions & 1 rubygems