class BELParser::Script::ApplyResourceURI

ApplyResourceURI applies the uri property to {BELParser::Parsers::AST::AnnotationDefinition} and {BELParser::Parsers::AST::NamespaceDefinition} child nodes.

Public Instance Methods

on_annotation_definition(node) click to toggle source
# File lib/bel_parser/script/apply_resource_uri.rb, line 9
def on_annotation_definition(node)
  update_uri_property(node)
end
on_namespace_definition(node) click to toggle source
# File lib/bel_parser/script/apply_resource_uri.rb, line 13
def on_namespace_definition(node)
  update_uri_property(node)
end

Private Instance Methods

update_uri_property(node) click to toggle source
# File lib/bel_parser/script/apply_resource_uri.rb, line 19
def update_uri_property(node)
  domain = node.domain
  if domain.url?
    resource_url = domain.child.string.string_literal
    node.uri     = BELParser::Resource.resolve_uri(resource_url)
  end

  node
end