Sha256: 6d2dc3e89686dc6fe82750d398cff5d7af9afadf973901613dd222224c0fc244

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

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

module Sugar
  module Topic
    module TopicRef
      
      # Returns an Array including all identifiers of this Topic.
      # Item identifiers start with a "^", subject locators start
      # with a "=", subject identifiers contain no prefix.
      #
      # :call-seq:
      #     topic_references -> Array of Strings
      #
      def topic_references
      #def identifiers
        subject_identifiers.map{|si| si.reference} +
        subject_locators.map{|sl| "=#{sl.reference}"} +
        item_identifiers.map{|ii| "^#{ii.reference}"}
      end


      # Returns all identifiers of this Topic as Array of Locators.
      #
      # :call-seq:
      #   topic_references_as_locators -> Array of Locators
      #
      def topic_references_as_locators
        # TODO Spec
        subject_identifiers.to_a + subject_locators.to_a + item_identifiers.to_a
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.2.0 lib/rtm/sugar/topic/topic_ref.rb