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

View File

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

View File

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