Class: ActiveFacts::API::InstanceIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/activefacts/api/instance_index.rb

Overview

Each Constellation maintains an InstanceIndex for each Concept in its Vocabulary. The InstanceIndex object is returned when you call @constellation.Concept with no arguments (where Concept is the concept name you’re interested in)

Instance Method Summary collapse

Instance Method Details

#[](*args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/activefacts/api/instance_index.rb', line 20

def [](*args)
  a = args
  #a = naked(args)
#        p "vvvv",
#          args,
#          a,
#          keys.map{|k| v=super(k); (RoleProxy === k ? "*" : "")+k.to_s+"=>"+(RoleProxy === v ? "*" : "")+v.to_s}*",",
#          "^^^^"
  h[*a]
  #super(*a)
end

#[]=(key, value) ⇒ Object

:nodoc:



15
16
17
18
# File 'lib/activefacts/api/instance_index.rb', line 15

def []=(key, value)   #:nodoc:
  raise "Adding RoleProxy to InstanceIndex" if value && RoleProxy === value
  h[key] = value
end

#delete_if(&b) ⇒ Object

:nodoc:



50
51
52
# File 'lib/activefacts/api/instance_index.rb', line 50

def delete_if(&b)   #:nodoc:
  h.delete_if &b
end

#keysObject

Return an array of the identifying role values arrays for all the instances of this concept



46
47
48
# File 'lib/activefacts/api/instance_index.rb', line 46

def keys
  h.keys
end

#map(&b) ⇒ Object



36
37
38
# File 'lib/activefacts/api/instance_index.rb', line 36

def map &b
  h.map &b
end

#sizeObject



32
33
34
# File 'lib/activefacts/api/instance_index.rb', line 32

def size
  h.size
end

#valuesObject

Return an array of all the instances of this concept



41
42
43
# File 'lib/activefacts/api/instance_index.rb', line 41

def values
  h.values
end