Class: NodeWidget

Inherits:
Shoes::Widget
  • Object
show all
Defined in:
lib/shoes/profiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ NodeWidget

Returns a new instance of NodeWidget.



151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/shoes/profiler.rb', line 151

def initialize(options={})
    name, method_info = options[:node]
    size = options[:size]*8
    ca = options[:color_alpha]
    infos = options[:info]
    self.width = size+4; self.height = size/2+4
    
    stack width: size+4, height: size/2+4 do
        oval 2,2, size, size/2, fill: ca == 1.0 ? red : red(ca)
        @n = inscription "#{name}\n#{infos}", font: "mono", align: "center", margin: 0, displace_top: (size/4)-8
    end
end