Module: CaTissue::Annotation

Includes:
CaRuby::IdAlias, CaRuby::Resource
Defined in:
lib/catissue/annotation/annotation.rb,
lib/catissue/annotation/proxy.rb,
lib/catissue/annotation/proxy_class.rb,
lib/catissue/database/annotation/id_generator.rb,
lib/catissue/database/annotation/entity_facade.rb,
lib/catissue/database/annotation/reference_writer.rb,
lib/catissue/database/annotation/annotation_service.rb,
lib/catissue/database/annotation/integration_service.rb

Overview

Annotation class mix-in.

Defined Under Namespace

Modules: Proxy, ProxyClass Classes: AnnotationService, EntityFacade, IdGenerator, IntegrationService, ReferenceWriter

Instance Method Summary collapse

Instance Method Details

#databaseObject

Returns the CaTissue::Database which stores this object.



13
14
15
# File 'lib/catissue/annotation/annotation.rb', line 13

def database
  CaTissue::Database.instance
end

#ensure_proxy_reflects_hookObject

Updates the annotation proxy to reflect the hook, if necessary.



20
21
22
23
# File 'lib/catissue/annotation/annotation.rb', line 20

def ensure_proxy_reflects_hook
  pxy = proxy || return
  pxy.ensure_identifier_reflects_hook
end

#hookAnnotatable

Returns the hook object which owns this annotation, or nil if this annotation is not directly owned by a hook entity.

Returns:

  • (Annotatable)

    the hook object which owns this annotation, or nil if this annotation is not directly owned by a hook entity



27
28
29
30
# File 'lib/catissue/annotation/annotation.rb', line 27

def hook
  pxy_attr = self.class.proxy_attribute
  send(pxy_attr) if pxy_attr
end

#ownerObject

If there is no conventional owner, then try the hook.



35
36
37
# File 'lib/catissue/annotation/annotation.rb', line 35

def owner
  super or hook
end

#proxyProxy

Returns the proxy which references this annotation.

Returns:

  • (Proxy)

    the proxy which references this annotation



40
41
42
43
44
45
46
47
# File 'lib/catissue/annotation/annotation.rb', line 40

def proxy
  # the annotation owner hook instance 
  ownr = hook || return
  # the hook -> annotation reference attribute
  attr = self.class.hook_proxy_attribute
  # the owner proxy for the attribute
  ownr.annotation_proxy(attr)
end