Class: BELParser::Language::Semantics::RelationshipDeprecation

Inherits:
Object
  • Object
show all
Includes:
SemanticsFunction
Defined in:
lib/bel_parser/language/semantics/relationship_deprecation.rb

Overview

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

Class Method Summary collapse

Class Method Details

.map(node, spec, _namespaces, will_match_partial = false) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# 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