Sha256: c78f0e814c6c4405777ee446bd62b8a2cbca7eb3461a690f6ae71ab582319910

Contents?: true

Size: 933 Bytes

Versions: 1

Compression:

Stored size: 933 Bytes

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

module RTM
  module Navigation
    module Occurrence
      
      # Returns the Topic this Characteristic (Name/Occurrence) belongs to.
      # The optional argument identifier filters the
      # Characteristic for its type. If the type
      # does not match, nil is returned.
      #
      # The identifier may be a Topic or Topic-Reference.
      #
      # :call-seq:
      #   reverse_characteristics -> Topic
      #   reverse_characteristics(identifier) -> Topic or nil
      #
      def reverse_characteristics(type=:any)
        return parent if type == :any
        _topic = topic_map.get(type)
        return nil unless _topic
        #filter the Name/Occurrence for its type:
        if _topic == self.type
          return parent
        else
          return nil
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.2.0 lib/rtm/navigation/occurrence/characteristics.rb