class Shul::App
Public Class Methods
new(shoes_app, doc, refresh: false, attributes: {})
click to toggle source
# File lib/shul.rb, line 361 def initialize(shoes_app, doc, refresh: false, attributes: {}) # To find out the window dimensions we must first render the app shul = Window.new(shoes_app, doc) if refresh then h = attributes shoes_app.start do |app| sleep 0.0001 box = doc.root.element('hbox | vbox') ht, wh = find_max_dimensions(box) h[:width],h[:height] = ht, wh win = window(h) { Window.new self, doc } app.close # closes the initial shoes app shul = nil end end doc.callback = shul h = doc.root.attributes if h[:onload] then name, raw_args = h[:onload].match(/(^[a-z]\w+)(?:\(([^\)]+))?/).captures m = shul.method(name.to_sym) raw_args ? m.call(Shellwords::shellwords(raw_args)) : m.call end end
Public Instance Methods
reload()
click to toggle source
# File lib/shul.rb, line 402 def reload() #alert 'hello world' '@shoes.inspect' end
Private Instance Methods
find_max_dimensions(e)
click to toggle source
# File lib/shul.rb, line 409 def find_max_dimensions(e) a = e.elements.map(&:obj) maxwidth = a.max_by{|x| x.width}.width maxheight = a.inject(0) {|r,x2| r += x2.height } [maxwidth, maxheight] end