Array of Attr s. It can hold body part for
using as a model data for Node#expand. Amrita#a() method is a shortcut for
Attr.new
:array |
[R] |
If you call a() { ... }, block yields to body
|
:body |
[R] |
If you call a() { ... }, block yields to body
|
:shared |
[RW] |
internal use only, never touch it!
true if this instance is shared by two or more elements
|
AttrArrayCommon
new(*attrs, &block) {|| ...}
|
# File lib/amrita/node.rb, line 218
def initialize(*attrs, &block)
@array = []
@shared = false
self << attrs
if block_given?
@body = yield
else
@body = Null
end
end
# File lib/amrita/node.rb, line 231
def add(*x)
x.each do |a|
case a
when Hash
a.each do |k, v|
self << Attr.new(k, v)
end
when Attr
@array << a
when Array, AttrArray
a.each do |aa|
self << aa
end
else
raise "can't accept #{a}"
end
end
self
end