From caa1da342c8911997c3e926429f1c8b5de75a029 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 22 Aug 2015 19:28:09 +0200 Subject: [PATCH] remove the root function (pass to super now) --- lib/base/list_view.rb | 13 ++++--------- lib/blocks_view.rb | 1 - lib/registers_view.rb | 6 +----- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/base/list_view.rb b/lib/base/list_view.rb index 41c272a..515ff8b 100644 --- a/lib/base/list_view.rb +++ b/lib/base/list_view.rb @@ -7,17 +7,12 @@ class ListView < ElementView @elements = [] end - # can be overriden to return a string that will be passed to div to create the root - # element for the list. See "div" in ElementView for possible strings - def root - "div" - end - - # create a root node acording to the "root" function (default div) + # create a root node acording to the tag given (default div) + # The tag name will be passed to the div function, so class and id may be set as well (see there) # draw all children and keep the elements as @elements # return (as per base class) the single root of the collection - def draw - @element = div(self.root) + def draw root = "div" + @element = div(root) @elements = @children.collect do | c | add_element c.draw end diff --git a/lib/blocks_view.rb b/lib/blocks_view.rb index 5b5fb6e..5c8e6f7 100644 --- a/lib/blocks_view.rb +++ b/lib/blocks_view.rb @@ -16,7 +16,6 @@ class BlocksView < ListView def instruction_changed return if @interpreter.block.name == active_block_name - puts "blocks changed to #{@interpreter.block.name}" @elements.last.at_css(".bright").remove_class("bright") append( BlockView.new(@interpreter.block) ) remove_first if( @elements.length > 5) diff --git a/lib/registers_view.rb b/lib/registers_view.rb index 7c89c2e..3387d79 100644 --- a/lib/registers_view.rb +++ b/lib/registers_view.rb @@ -13,12 +13,8 @@ class RegistersView < ListView super(kids) end - def root - "div.registers_view" - end - def draw - super() + super( "div.registers_view" ) @element.children.each do |reg| elem = div("div.register_view") wrap_node_with reg , elem