Class: Harmony::Page::Window
- Inherits:
-
Object
- Object
- Harmony::Page::Window
- Extended by:
- Forwardable
- Defined in:
- lib/harmony/page.rb
Overview
Window factory
Instance Attribute Summary collapse
-
#run_time ⇒ Object
readonly
Returns the value of attribute run_time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri = 'about:blank') ⇒ Window
constructor
A new instance of Window.
- #open(uri) ⇒ Object
Constructor Details
#initialize(uri = 'about:blank') ⇒ Window
Returns a new instance of Window.
104 105 106 |
# File 'lib/harmony/page.rb', line 104 def initialize(uri='about:blank') open(uri) end |
Instance Attribute Details
#run_time ⇒ Object (readonly)
Returns the value of attribute run_time.
100 101 102 |
# File 'lib/harmony/page.rb', line 100 def run_time @run_time end |
Class Method Details
.blank ⇒ Object
130 131 132 |
# File 'lib/harmony/page.rb', line 130 def self.blank new end |
.from_document(document) ⇒ Object
125 126 127 128 |
# File 'lib/harmony/page.rb', line 125 def self.from_document(document) Tempfile.open('harmony') {|f| f << document; @path = f.path } new("file://#{@path}") end |
.from_uri(uri) ⇒ Object
121 122 123 |
# File 'lib/harmony/page.rb', line 121 def self.from_uri(uri) new(uri) end |
Instance Method Details
#open(uri) ⇒ Object
116 117 118 119 |
# File 'lib/harmony/page.rb', line 116 def open(uri) @browser = run_time.evaluate("window.open('#{uri}')") run_time end |