assign @element explicitly (remove create_element)

This commit is contained in:
Torsten Ruger 2015-08-22 01:37:15 +02:00
parent 0d4813df13
commit 3fa685a0bb
3 changed files with 7 additions and 8 deletions

View File

@ -5,7 +5,6 @@ class ListView < ElementView
def initialize children def initialize children
@children = children @children = children
@elements = [] @elements = []
@container_element = nil
end end
def root def root
@ -13,13 +12,13 @@ class ListView < ElementView
end end
def draw on def draw on
@container_element = div(self.root) @element = div(self.root)
@elements = @children.collect do | c | @elements = @children.collect do | c |
elem = c.draw(@container_element) elem = c.draw(@element)
elem.append_to(@container_element) elem.append_to(@element)
elem elem
end end
@container_element @element
end end
end end

View File

@ -20,10 +20,10 @@ class RegistersView < ListView
def draw def draw
list = super() list = super()
list = list.children.each do |reg| list = list.children.each do |reg|
elem = create_element("div.register_view") elem = div("div.register_view")
wrap_node_with reg , elem wrap_node_with reg , elem
end end
@container_element @element
end end
def register_changed reg , old , value def register_changed reg , old , value

View File

@ -5,7 +5,7 @@ class StatusView < ElementView
end end
def draw def draw
create_element(".status_view") << @element = div(".status_view") <<
div("h4.tick" , "Interpreter" ) << div("h4.tick" , "Interpreter" ) <<
div("span" , tick_text) << div("span" , tick_text) <<
div("button.act" , "Next") << div("button.act" , "Next") <<