rubyx-debugger/lib/list_view.rb

26 lines
430 B
Ruby
Raw Normal View History

2015-08-20 14:48:45 +02:00
require "element_view"
class ListView < ElementView
2015-08-20 19:40:47 +02:00
def initialize children
@children = children
2015-08-20 16:07:44 +02:00
@elements = []
2015-08-20 19:40:47 +02:00
@container_element = nil
2015-08-20 14:48:45 +02:00
end
def root
"div"
end
2015-08-20 19:40:47 +02:00
def draw on
@container_element = create_element(self.root)
2015-08-20 19:40:47 +02:00
@elements = @children.collect do | c |
elem = c.draw(@container_element)
elem.append_to(@container_element)
elem
end
@container_element
end
2015-08-20 14:48:45 +02:00
end