Class: Container
- Inherits:
-
Object
show all
- Includes:
- Assert
- Defined in:
- lib/ribit/contentparser.rb
Instance Method Summary
collapse
Methods included from Assert
assert, #assert, assert_nil, #assert_nil, #assert_not_nil, assert_not_nil, raise_exception
Constructor Details
#initialize(parentContainer) ⇒ Container
Returns a new instance of Container.
742
743
744
745
|
# File 'lib/ribit/contentparser.rb', line 742
def initialize( parentContainer )
@parent = parentContainer
@childs = Array.new
end
|
Instance Method Details
#<<(data) ⇒ Object
777
778
779
|
# File 'lib/ribit/contentparser.rb', line 777
def << ( data )
@childs.last << data
end
|
#add_child(container) ⇒ Object
753
754
755
|
# File 'lib/ribit/contentparser.rb', line 753
def add_child( container )
@childs.push( container )
end
|
#childs? ⇒ Boolean
782
783
784
|
# File 'lib/ribit/contentparser.rb', line 782
def childs?
return @childs.size() > 0
end
|
#get_childs ⇒ Object
792
793
794
|
# File 'lib/ribit/contentparser.rb', line 792
def get_childs
return @childs
end
|
#get_parent ⇒ Object
748
749
750
|
# File 'lib/ribit/contentparser.rb', line 748
def get_parent
return @parent
end
|
#replace(index, replacingContainers) ⇒ Object
763
764
765
766
767
768
769
770
771
772
773
774
|
# File 'lib/ribit/contentparser.rb', line 763
def replace( index, replacingContainers )
firstPart = @childs[0, index]
lastPart = @childs[index + 1, @childs.length]
newChilds = Array.new
newChilds.concat( firstPart ) unless firstPart == nil
newChilds.concat( replacingContainers ) unless replacingContainers == nil
newChilds.concat( lastPart ) unless lastPart == nil
@childs = newChilds
end
|
#set_childs(newChilds) ⇒ Object
758
759
760
|
# File 'lib/ribit/contentparser.rb', line 758
def set_childs( newChilds )
@childs = newChilds
end
|
#text? ⇒ Boolean
787
788
789
|
# File 'lib/ribit/contentparser.rb', line 787
def text?
return false
end
|
#to_s ⇒ Object
797
798
799
800
801
802
803
804
|
# File 'lib/ribit/contentparser.rb', line 797
def to_s
result = ''
@childs.each do |item|
result << item.to_s
end
return result
end
|