some real models

This commit is contained in:
Torsten Ruger
2015-07-30 10:09:04 +03:00
parent a2f3daa828
commit d8a3657365
5 changed files with 36 additions and 26 deletions

View File

@ -2,12 +2,14 @@
require "salama"
require_relative "interpreter"
module Main
class MainController < Volt::ModelController
def index
init_machine
init_classes
init_registers
init_blocks
end
def about
@ -26,9 +28,7 @@ module Main
def init_registers
page._registers!.clear
@interpreter.registers.each do |reg , val|
r = Volt::Model.new :name => reg
r._value = val
page._registers << r
page._registers << RegisterModel.new( :name => reg , :value => val)
end
end
def init_classes
@ -39,6 +39,11 @@ module Main
page._classes << c
end
end
def init_blocks
blocks = BlocksModel.new
page._blocks = blocks
@interpreter.register_event(:instruction_changed, blocks)
end
# The main template contains a #template binding that shows another
# template. This is the path to that template. It may change based
# on the params._component, params._controller, and params._action values.