Class: Shul::Window
- Inherits:
-
Object
- Object
- Shul::Window
- Defined in:
- lib/shul.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
- #add_element(node, x) ⇒ Object
-
#initialize(shoes, doc) ⇒ Window
constructor
A new instance of Window.
- #refresh ⇒ Object
Constructor Details
#initialize(shoes, doc) ⇒ Window
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/shul.rb', line 333 def initialize(shoes, doc) @shoes = shoes @width, @height = 100, 100 @doc = doc def @doc.element_by_id(id) self.root.element("//*[@id='#{id}']") end @doc.root.elements.each do |x| method(x.name.sub(':','_').to_sym).call(x) unless x.name == 'script' end @doc.root.xpath('script').each {|x| script x } h = @doc.root.attributes if h[:onkeypress] then shoes.keypress do |k| method(h[:onkeypress][/^[a-z]\w+/].to_sym).call(k) end end end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
331 332 333 |
# File 'lib/shul.rb', line 331 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
331 332 333 |
# File 'lib/shul.rb', line 331 def width @width end |
Class Method Details
.element_by_id(id) ⇒ Object
340 341 342 |
# File 'lib/shul.rb', line 340 def @doc.element_by_id(id) self.root.element("//*[@id='#{id}']") end |
Instance Method Details
#add_element(node, x) ⇒ Object
360 361 362 363 364 365 |
# File 'lib/shul.rb', line 360 def add_element(node, x) node.obj = method(x.name.sub(':','_').to_sym).call(x) refresh() end |
#refresh ⇒ Object
367 368 369 |
# File 'lib/shul.rb', line 367 def refresh @shoes.flush end |