class BOBrb::ChildArray

Public Class Methods

new(dataset, parent) click to toggle source
# File lib/BOBrb/child_array.rb, line 3
def initialize (dataset, parent)
        @dataset = dataset
        @parent = parent
        @bobs = []
end

Public Instance Methods

a(data, options=nil) click to toggle source
# File lib/BOBrb/child_array.rb, line 65
def a (data, options=nil)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                if @bobs[i]
                        @bobs[i] = @bobs[i].a(data, options)
                else
                        @bobs.push(@parent.a(data, options))
                end
        end
        return self
end
append(data, options=nil) click to toggle source
# File lib/BOBrb/child_array.rb, line 62
def append (data, options=nil)
        self.a(data, options)
end
cl(object_class) click to toggle source
# File lib/BOBrb/child_array.rb, line 33
def cl (object_class)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                @bobs[i].cl(object_class) if @bobs[i]
        end
        return self
end
classs(object_class) click to toggle source
# File lib/BOBrb/child_array.rb, line 30
def classs (object_class)
        self.cl(object_class)
end
co(content) click to toggle source
# File lib/BOBrb/child_array.rb, line 13
def co (content)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                @bobs[i].co(content) if @bobs[i]
        end
        return self
end
content(content) click to toggle source

No point in doing this on parent. Does not make sense to do “.do(data).id(BOBrb::Element.data)”

# File lib/BOBrb/child_array.rb, line 10
def content (content)
        self.co(content)
end
d(data) click to toggle source
# File lib/BOBrb/child_array.rb, line 118
def d (data)
        @bobs.each_with_index do |bob, i|
                BOBrb::Element.data = item
                if @bobs[i]
                        @bobs[i] = @bobs[i].d(data)
                else
                        @bobs.push(@parent.d(data))
                end
        end
                
        return self
end
do(data) click to toggle source

TODO: do(data).do(data2) does not behave correctly

# File lib/BOBrb/child_array.rb, line 115
def do (data)
        self.d(data)
end
i(data, options=nil) click to toggle source
# File lib/BOBrb/child_array.rb, line 50
def i (data, options=nil)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                if @bobs[i]
                        @bobs[i] = @bobs[i].insert(data, options)
                else
                        @bobs.push(@parent.insert(data, options))
                end
        end
                        
        return self
end
id(object_id) click to toggle source
# File lib/BOBrb/child_array.rb, line 40
def id (object_id)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                @bobs[i].id(object_id) if @bobs[i]
        end
        return self
end
insert(data, options=nil) click to toggle source
# File lib/BOBrb/child_array.rb, line 47
def insert (data, options=nil)
        self.i(data, options)
end
p(data, options=nil) click to toggle source
# File lib/BOBrb/child_array.rb, line 80
def p (data, options=nil)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                if @bobs[i]
                        @bobs[i] = @bobs[i].p(data, options)
                else
                        @bobs.push(@parent.p(data, options))
                end
        end

        return self
end
pp() click to toggle source
# File lib/BOBrb/child_array.rb, line 95
def pp
        self.s(true)
end
prepend(data, options=nil) click to toggle source
# File lib/BOBrb/child_array.rb, line 77
def prepend (data, options=nil)
        self.p(data, options)
end
prettyPrint() click to toggle source
# File lib/BOBrb/child_array.rb, line 92
def prettyPrint
        self.pp()
end
s(pretty = false) click to toggle source
# File lib/BOBrb/child_array.rb, line 101
def s (pretty = false)
        if @parent
                return @parent.s(pretty)
        else
                html_string = ""
                for bob in @bobs
                        bob.parent = false
                        html_string += bob.s(pretty)
                end
                return html_string
        end
end
st(style) click to toggle source
# File lib/BOBrb/child_array.rb, line 23
def st (style)
        @dataset.each_with_index do |item, i|
                BOBrb::Element.data = item
                @bobs[i].st(style) if @bobs[i]
        end
        return self
end
style(style) click to toggle source
# File lib/BOBrb/child_array.rb, line 20
def style (style)
        self.st(style)
end
toString() click to toggle source
# File lib/BOBrb/child_array.rb, line 98
def toString
        self.s()
end
u() click to toggle source
# File lib/BOBrb/child_array.rb, line 133
def u
        unless @bobs[0]
                BOBrb::Element.data = nil
                return @parent
        end
        @bobs.each_with_index do |bob, i|
                @bobs[i] = @bobs[i].u()
        end
        if @bobs[0] == @parent
                BOBrb::Element.data = nil
                return @parent
        else
                return self
        end
end
up() click to toggle source
# File lib/BOBrb/child_array.rb, line 130
def up
        self.u()
end