Sha256: f37b861cddb1d7450cc545d7bea52be86da60a10da075e8748405193609695de
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::Sugar module Association # This module implements methods for Hash-like access in Associations. module HashAccess # Returns all Roles of this Association. # # If type is given, returns the Roles of this Association # whose Role type match type. # Type may be a topic reference. # # The result may be empty. # # :call-seq: # [] -> Array of Roles # [type] -> Array of Roles # def [](type=:any) return getRoles.to_a if type == :any return getRoles.to_a unless type type = topic_map.get(type) if type return getRoles(type).to_a else return [] end end # Creates a new Role in this Association where type specifies the # Role type and player the associated Role player. # Type and player may each be a topic reference. # # :call-seq: # [type]= player # # TODO Issue #919 def []=(type,player) create_role(type,player) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems