Class: AEMReference::Specifier
Overview
BASE CLASS FOR ALL REFERENCE FORMS
Direct Known Subclasses
Instance Method Summary collapse
- #AEM_pack_self(codecs) ⇒ Object
- #AEM_root ⇒ Object
- #AEM_set_desc(desc) ⇒ Object
- #AEM_true_self ⇒ Object
-
#initialize(container, key) ⇒ Specifier
constructor
A new instance of Specifier.
Methods inherited from Query
#==, #AEM_comparable, #hash, #inspect
Constructor Details
#initialize(container, key) ⇒ Specifier
Returns a new instance of Specifier.
130 131 132 133 134 135 |
# File 'lib/_aem/aemreference.rb', line 130 def initialize(container, key) super() @_desc = nil @_container = container @_key = key end |
Instance Method Details
#AEM_pack_self(codecs) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/_aem/aemreference.rb', line 157 def AEM_pack_self(codecs) # Pack this Specifier; called by Codecs#pack, which passes itself so that specifiers in this reference can pack their selectors. if not @_desc @_desc = _pack_self(codecs) # once packed, cache this AEDesc for efficiency end return @_desc end |
#AEM_root ⇒ Object
137 138 139 140 141 142 |
# File 'lib/_aem/aemreference.rb', line 137 def AEM_root # Get reference's root node. Used by range and filter specifiers when determining type of reference # passed as argument(s): range specifiers require absolute (app-based) or container (con-based) # references; filter specifiers require an item (its-based) reference. return @_container.AEM_root end |
#AEM_set_desc(desc) ⇒ Object
153 154 155 |
# File 'lib/_aem/aemreference.rb', line 153 def AEM_set_desc(desc) @_desc = desc end |
#AEM_true_self ⇒ Object
144 145 146 147 148 149 150 151 |
# File 'lib/_aem/aemreference.rb', line 144 def AEM_true_self # Called by specifier classes when creating a reference to sub-element(s) of the current reference. # - An AllElements specifier (which contains 'want', 'form', 'seld' and 'from' values) will return an UnkeyedElements object (which contains 'want' and 'from' data only). The new specifier object (ElementByIndex, ElementsByRange, etc.) wraps itself around this stub and supply its own choice of 'form' and 'seld' values. # - All other specifiers simply return themselves. # #This sleight-of-hand allows foo.elements('bar ') to produce a legal reference to all elements, so users don't need to write foo.elements('bar ').all to achieve the same goal. This isn't a huge deal for aem, but makes a significant difference to the usability of user-friendly wrappers like appscript, and dealing with the mechanics of it here helps keep other layers simple. return self end |