class BELParser::Language::Semantics::RelationshipDeprecation

RelationshipDeprecation implements a {SemanticsFunction} that maps a {BELParser::Parsers::AST::Relationship} to a {SemanticsWarning} if the referenced relationship is deprecated for the {BELParser::Language::Specification}.

Public Class Methods

map(node, spec, _namespaces, will_match_partial = false) click to toggle source
# File lib/bel_parser/language/semantics/relationship_deprecation.rb, line 15
def self.map(node, spec, _namespaces, will_match_partial = false)
  return nil unless node.is_a?(BELParser::Parsers::AST::Relationship)
  return nil if node.string_literal.nil?

  relationship_name = node.string_literal
  rel               = spec.relationship(relationship_name.to_sym)
  return nil unless rel

  RelationshipDeprecationWarning.new(node, spec, rel) if rel.deprecated?
end