Module: Concept::SKOSXL::Extension

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concept/skosxl/extension.rb

Instance Method Summary collapse

Instance Method Details

#labelings_by_id(relation_name, language) ⇒ Object



34
35
36
37
38
# File 'app/models/concept/skosxl/extension.rb', line 34

def labelings_by_id(relation_name, language)
  (@labelings_by_id && @labelings_by_id[relation_name] && @labelings_by_id[relation_name][language]) ||
    self.send(relation_name).by_label_language(language).
        map { |l| l.target.origin }.join(Iqvoc::InlineDataHelper::JOINER)
end

#labelings_by_id=(hash) ⇒ Object



30
31
32
# File 'app/models/concept/skosxl/extension.rb', line 30

def labelings_by_id=(hash)
  @labelings_by_id = hash
end

#valid_label_languageObject



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/models/concept/skosxl/extension.rb', line 40

def valid_label_language
  (@labelings_by_id || {}).each { |labeling_class_name, origin_mappings|
    origin_mappings.each { |language, new_origins|
      new_origins = new_origins.split(Iqvoc::InlineDataHelper::SPLITTER)
      Iqvoc::XLLabel.base_class.by_origin(new_origins).each do |label|
        if label.language != language.to_s
          errors.add(:base,
              I18n.t("txt.controllers.versioned_concept.label_error") % label)
        end
      end
    }
  }
end