rubyx-debugger/lib/base/list_view.rb

25 lines
359 B
Ruby
Raw Normal View History

2015-08-21 20:05:49 +02:00
require_relative "element_view"
2015-08-20 14:48:45 +02:00
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 14:48:45 +02:00
end
def root
"div"
end
2015-08-20 19:40:47 +02:00
def draw on
@element = div(self.root)
2015-08-20 19:40:47 +02:00
@elements = @children.collect do | c |
elem = c.draw(@element)
elem.append_to(@element)
2015-08-20 19:40:47 +02:00
elem
end
@element
2015-08-20 19:40:47 +02:00
end
2015-08-20 14:48:45 +02:00
end