Class: Shul::Main

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

Instance Method Summary collapse

Constructor Details

#initialize(shoes, source) ⇒ Main

Returns a new instance of Main.



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
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/shul.rb', line 81

def initialize(shoes, source)

  doc = if source.is_a? Rexle then source
  else
    xml, _ = RXFHelper.read(source)
    Rexle.new(xml)
  end    
  
  attr = {width: 300, height: 200}.merge doc.root.attributes.to_h      
  
  bflag = if attr.has_key? :width and attr.has_key? :height then
    
    attr[:width] = attr[:width].to_i
    attr[:height] = attr[:height].to_i
    
    false         
  else
    true
  end
  
  shoes.app(attr) do  

    def reload()
      puts 'not yet implemented'
    end
    
    button 'test' do
      alert('fun')
    end
    
    
    shul = Shul::App.new self, doc, refresh: bflag, \
                                      attributes: {title: 'Shul'}
    Thread.new do
      
      # The following file is generated by Shoes and needs to be 
      # removed to avoid file locks in a thin client server setup.
      
      if File.exists? '/tmp/__green_shoes_temporary_file__' then
        FileUtils.rm '/tmp/__green_shoes_temporary_file__'
      end
      
    end
      
  end
  
end