shul 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/shul.rb +32 -13
  5. metadata +1 -1
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6264c6ebc6265bf41669a6dcbb5f46d4f59142f2
4
- data.tar.gz: e31ae1a893abe069a371637309b01f9e4635ff2d
3
+ metadata.gz: 0b168ef512ec4e28b1abbb2f8f989ca38c91b3d6
4
+ data.tar.gz: 468803f88af3fc33ed13a7c8b55457cf7ed5fbd5
5
5
  SHA512:
6
- metadata.gz: 06018f1368736724035a1b5242ab14c7e936fcc2925662a38692f3b14527dc0b42f4725d09c80025f499cdb61cf248a2ad9e19ad91ea2a71a8eba235370dfa44
7
- data.tar.gz: 88fe48f88f19ac5715c01b0b7ebbd86baefb73d488d31567a9d3497b63834d1fdb248edd5dce408213da945aeb474ba2fa63aac4b22b99352f86e1944686f68a
6
+ metadata.gz: afb4ed8944c840d8c22a5ba0356e0d489571d137f490fca2ea01b648d5ae8cc6c7a3d56860533e5cc403018ecbc2fbf140c96bc9cf886dc56e6da9e9a825d268
7
+ data.tar.gz: fb1da1638fc60ce7942bec6a0f9f3a56e8384a73cd6e9290cbeebb3080fc745ca4a28270b19f59f09581ee8f7cde7a06104de4198ba938eebeb73e1a562ff6a9
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/shul.rb CHANGED
@@ -54,9 +54,21 @@ module Shul
54
54
 
55
55
  doc = Rexle.new xml
56
56
 
57
- shoes.app(resizeable: false, width: 100, height: 100) do
57
+ attr = doc.root.attributes.to_h
58
+
59
+ bflag = if attr.has_key? :width and attr.has_key? :height then
60
+
61
+ attr[:width] = attr[:width].to_i
62
+ attr[:height] = attr[:height].to_i
63
+
64
+ false
65
+ else
66
+ true
67
+ end
68
+
69
+ shoes.app(attr) do
58
70
 
59
- shul = Shul::App.new self, doc
71
+ shul = Shul::App.new self, doc, refresh: bflag, attributes: attr
60
72
 
61
73
  end
62
74
 
@@ -66,7 +78,7 @@ module Shul
66
78
 
67
79
  class App
68
80
 
69
- def initialize(shoes_app, source)
81
+ def initialize(shoes_app, source, refresh: false, attributes: {title: 'Shul'})
70
82
 
71
83
  doc = if source.is_a? Rexle then source
72
84
  else
@@ -74,25 +86,32 @@ module Shul
74
86
  Rexle.new(xml)
75
87
  end
76
88
 
89
+
77
90
  # To find out the window dimensions we must first render the app
78
91
  shul = Window.new(shoes_app, doc)
79
92
 
80
- shoes_app.start do |app|
81
-
82
- sleep 0.0001
93
+ if refresh then
94
+
95
+ h = attributes
83
96
 
84
- box = doc.root.element('hbox | vbox')
85
- wdth, hght = find_max_dimensions(box)
97
+ shoes_app.start do |app|
86
98
 
87
- h = {title: 'Shul', width: wdth, height: hght}\
88
- .merge doc.root.attributes
99
+ sleep 0.0001
100
+
101
+ box = doc.root.element('hbox | vbox')
89
102
 
90
- win = window(h) { Window.new self, doc }
103
+ ht, wh = find_max_dimensions(box)
104
+
105
+ h[:width],h[:height] = ht.to_i, wh.to_i
106
+
107
+ win = window(h) { Window.new self, doc }
91
108
 
92
- app.close # closes the initial shoes app
93
- shul = nil
109
+ app.close # closes the initial shoes app
110
+ shul = nil
94
111
 
112
+ end
95
113
  end
114
+
96
115
  end
97
116
 
98
117
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file