Class: IRVisualizerController

Inherits:
Object
  • Object
show all
Includes:
JRubyFX::Controller
Defined in:
lib/jruby_visualizer/ir_visualizer.rb

Overview

The controller loads the UI file and takes care of the diffs and updating the UI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiler_data) ⇒ IRVisualizerController

Returns a new instance of IRVisualizerController.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/jruby_visualizer/ir_visualizer.rb', line 54

def initialize(compiler_data)
  @compiler_data = compiler_data
  pretty_ir_string = IRPrettyPrinter.pretty_string(@compiler_data.ir_scope)
  @ir_view.text = @new_ir_string = @previous_ir_string = pretty_ir_string

  @compiler_data.ir_scope_property.add_invalidation_listener do |new_scope_property|
    @previous_ir_string = @new_ir_string
    @new_ir_string = IRPrettyPrinter.pretty_string(new_scope_property.get)
    diff_string = Diffy::Diff.new(@previous_ir_string, @new_ir_string).to_s
    @ir_view.text =
    if diff_string.empty?
      @new_ir_string
    else
      diff_string
    end
  end
end

Instance Attribute Details

#compiler_dataObject (readonly)

Returns the value of attribute compiler_data.



52
53
54
# File 'lib/jruby_visualizer/ir_visualizer.rb', line 52

def compiler_data
  @compiler_data
end