Sha256: 2e6448c75619a58281b608e48c0115b3c29e81081dd1c3f565da4f5544f35ef1

Contents?: true

Size: 924 Bytes

Versions: 4

Compression:

Stored size: 924 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 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

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.3.1 lib/rtm/navigation/occurrence/characteristics.rb
rtm-0.3.0 lib/rtm/navigation/occurrence/characteristics.rb
rtm-0.2.1 lib/rtm/navigation/occurrence/characteristics.rb
rtm-0.2 lib/rtm/navigation/occurrence/characteristics.rb