Sha256: b9b83581ac8a069d5436555189e459d2d86bb16b7cb13a2dd94fc8c5d72b25e0

Contents?: true

Size: 733 Bytes

Versions: 63

Compression:

Stored size: 733 Bytes

Contents

module BELParser
  module Script
    # ApplyResourceURI applies the _uri_ property to
    # {BELParser::Parsers::AST::AnnotationDefinition} and
    # {BELParser::Parsers::AST::NamespaceDefinition} child nodes.
    class ApplyResourceURI
      include AST::Processor::Mixin

      def on_annotation_definition(node)
        update_uri_property(node)
      end

      def on_namespace_definition(node)
        update_uri_property(node)
      end

      private

      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
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
bel_parser-1.1.6-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.6 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.5 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.4-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.4 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.3-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.3 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.2-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.2 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.1-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.1.1 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.8-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.8 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.7-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.7 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.6-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.6 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.5-java lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.5 lib/bel_parser/script/apply_resource_uri.rb
bel_parser-1.0.4-java lib/bel_parser/script/apply_resource_uri.rb