Sha256: ed3ddcff421c66ae9bbda92a885216f3e0045c27039bbd18c6689d8f998c1239

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 Bytes

Contents

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

module RTM
  module Navigation  
    module Topic
      
      # Returns all Names and Occurrences of this Topic.
      # If an identifier is given, only those Names and Occurrences are returned,
      # whose type or supertypes include the identifier.
      #
      # Identifier may be a topic reference.
      #
      # The result may be empty.
      #
      # :call-seq:
      #   characteristics -> Array of Names and Occurrences
      #   characteristics(identifier) -> Array of Names and Occurrences
      #
      def characteristics(type = :any)
        _characteristics = names.to_a + occurrences.to_a
        return _characteristics if type == :any
        _type = topic_map.get(type)
        return [] unless _type
        #_characteristics.select{|c| c.type == _topic}
        _characteristics.select{|c| c.type.supertypes.include?(_type)}
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.3.1 lib/rtm/navigation/topic/characteristics.rb