Sha256: 3f16bf6d76b722e3f3f0768fa68544e7c63773741c8843a0ed9b4a1697d5d611

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

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

module RTM
  module Validation

    module Association
      def valid?
        return false unless parent
        return false unless type
        return false if roles.empty?
        true
      end
    end

    module Role
      def valid?
        return false unless player
        return false unless type
        return false unless parent
        true
      end
    end

    module Occurrence
      def valid?
        return false unless type
        return false unless parent
        true
      end
    end

    module Topic
      def valid?
        return false if item_identifiers.empty? && subject_identifiers.empty? && subject_locators.empty?
        true
      end
    end

    module TopicMap
    end

    module Name
    end

    module Variant
      def valid?
        return false if scope.empty?
        return false if parent.scope.size == scope.size
        parent.scope.each do |t|
          return false unless scope.include?(t)
        end
        true
      end
    end
    module Construct
      def valid?
        true
      end
    end
    RTM.register_extension(self)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.3.1 lib/rtm/validation.rb
rtm-0.3.0 lib/rtm/validation.rb
rtm-0.2.1 lib/rtm/validation.rb
rtm-0.2 lib/rtm/validation.rb