Sha256: a52b2aa98b563a8a587d42b61c93584f31b0efff1faa5739978cf97eefa4bca8
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module 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 or 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, String-Reference or Locator. # # :call-seq: # [type]= player # # TODO Issue #919 def []=(type,player) create_role(type,player) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rtm-0.2.0 | lib/rtm/sugar/association/hash_access.rb |