Class: Shul::Window

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shoes, doc) ⇒ Window

Returns a new instance of Window.



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/shul.rb', line 261

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 }

end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



259
260
261
# File 'lib/shul.rb', line 259

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



259
260
261
# File 'lib/shul.rb', line 259

def width
  @width
end

Class Method Details

.element_by_id(id) ⇒ Object



268
269
270
# File 'lib/shul.rb', line 268

def @doc.element_by_id(id)
  self.root.element("//*[@id='#{id}']")
end