Sha256: 7b7936179823c0c2afbb3841d8677171e40424df6cdf093b2780169abe9b7349

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

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

module RTM
  module Navigation
    module Name
      
      # 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/name/characteristics.rb