Class: Shul::App

Inherits:
Object
  • Object
show all
Defined in:
lib/shul.rb

Instance Method Summary collapse

Constructor Details

#initialize(shoes_app, source, refresh: false, attributes: {title: 'Shul'}) ⇒ App

Returns a new instance of App.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/shul.rb', line 81

def initialize(shoes_app, source, refresh: false, attributes: {title: 'Shul'})
  
  doc = if source.is_a? Rexle then source
  else
    xml, _ = RXFHelper.read(source)
    Rexle.new(xml)
  end      

              
  # 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.to_i, wh.to_i
      
      win = window(h) {  Window.new self, doc }

      app.close # closes the initial shoes app        
      shul = nil

    end        
  end
  
end