Class: AEMReference::ElementByRelativePosition

Inherits:
PositionSpecifier show all
Defined in:
lib/_aem/aemreference.rb

Constant Summary collapse

KeyForm =

Note: this class subclasses PositionSpecifier, not SingleElement, as it needs the container reference intact. (SingleElement#initialize calls the container’s AEM_true_self method, which breaks up AllElements specifiers - not what we want here.)

AEMReference.pack_enum(KAE::FormRelativePosition)

Constants inherited from PositionSpecifier

PositionSpecifier::After, PositionSpecifier::Before, PositionSpecifier::Beginning, PositionSpecifier::End, PositionSpecifier::Next, PositionSpecifier::Previous

Instance Attribute Summary

Attributes inherited from PositionSpecifier

#AEM_want

Instance Method Summary collapse

Methods inherited from PositionSpecifier

#_pack_self, #after, #before, #beginning, #begins_with, #contains, #elements, #end, #ends_with, #eq, #ge, #gt, #is_in, #le, #lt, #ne, #next, #previous, #property, #user_property

Methods inherited from Specifier

#AEM_pack_self, #AEM_root, #AEM_set_desc, #AEM_true_self

Methods inherited from Query

#==, #AEM_comparable, #hash, #inspect

Constructor Details

#initialize(wantcode, container, key, keyname) ⇒ ElementByRelativePosition

Returns a new instance of ElementByRelativePosition.



472
473
474
475
# File 'lib/_aem/aemreference.rb', line 472

def initialize(wantcode, container, key, keyname)
  @_keyname = keyname
  super(wantcode, container, key)
end

Instance Method Details

#_pack_key(codecs) ⇒ Object



477
478
479
# File 'lib/_aem/aemreference.rb', line 477

def _pack_key(codecs)
  return codecs.pack(@_key)
end

#AEM_resolve(obj) ⇒ Object



485
486
487
# File 'lib/_aem/aemreference.rb', line 485

def AEM_resolve(obj)
  return @_container.AEM_resolve(obj).send(@_keyname, @AEM_want)
end

#to_sObject



481
482
483
# File 'lib/_aem/aemreference.rb', line 481

def to_s
  return "#{@_container}.#{@_keyname}(#{@AEM_want.inspect})"
end