Class: Shul::Window
- Inherits:
-
Object
- Object
- Shul::Window
- Defined in:
- lib/shul.rb
Defined Under Namespace
Classes: Radiogroup
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) ⇒ Object
-
#initialize(shoes, doc) ⇒ Window
constructor
A new instance of Window.
- #refresh ⇒ Object
- #remove_element(node) ⇒ Object
Constructor Details
#initialize(shoes, doc) ⇒ Window
Returns a new instance of Window.
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/shul.rb', line 407 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.
405 406 407 |
# File 'lib/shul.rb', line 405 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
405 406 407 |
# File 'lib/shul.rb', line 405 def width @width end |
Class Method Details
.element_by_id(id) ⇒ Object
414 415 416 |
# File 'lib/shul.rb', line 414 def @doc.element_by_id(id) self.root.element("//*[@id='#{id}']") end |
Instance Method Details
#add_element(node) ⇒ Object
434 435 436 437 438 439 |
# File 'lib/shul.rb', line 434 def add_element(node) node.obj = method(node.name.sub(':','_').to_sym).call(node) refresh() end |
#refresh ⇒ Object
441 442 443 |
# File 'lib/shul.rb', line 441 def refresh @shoes.flush if @shoes end |
#remove_element(node) ⇒ Object
445 446 447 448 |
# File 'lib/shul.rb', line 445 def remove_element(node) node.obj.clear refresh() end |