Class: IeHandler::IePage
- Inherits:
-
Object
- Object
- IeHandler::IePage
- Defined in:
- lib/ie_handler.rb
Constant Summary collapse
- IE_APP =
"InternetExplorer.Application"
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#ie ⇒ Object
Returns the value of attribute ie.
Class Method Summary collapse
Instance Method Summary collapse
-
#add(obj) ⇒ Object
DOM new element addition.
- #attr(name, value = nil) ⇒ Object
- #back ⇒ Object
- #click ⇒ Object
- #close ⇒ Object
- #each {|_self| ... } ⇒ Object
-
#find ⇒ Object
initalization.
-
#go(url, visible = true) ⇒ Object
move to the specified url.
- #html(content = nil) ⇒ Object
-
#initialize(url) ⇒ IePage
constructor
instance methods.
- #method(name) ⇒ Object
- #method_missing(method_name, *args) ⇒ Object
-
#methods(search_word = nil) ⇒ Object
for inspect methods.
-
#sa ⇒ Object
Saved Access Save ie object ex) save tr and use td using saved tr object.
-
#wait ⇒ Object
wait during loading.
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
139 140 141 |
# File 'lib/ie_handler.rb', line 139 def method_missing(method_name, *args) @doc.send(method_name, *args) end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
13 14 15 |
# File 'lib/ie_handler.rb', line 13 def doc @doc end |
#ie ⇒ Object
Returns the value of attribute ie.
13 14 15 |
# File 'lib/ie_handler.rb', line 13 def ie @ie end |
Class Method Details
.make_elem(ie_obj, elem_name) ⇒ Object
145 146 147 148 149 |
# File 'lib/ie_handler.rb', line 145 def make_elem ie_obj, elem_name obj = ie_obj.clone obj.doc = ie_obj.ie.document.createElement(elem_name) obj end |
Instance Method Details
#add(obj) ⇒ Object
DOM new element addition
106 107 108 |
# File 'lib/ie_handler.rb', line 106 def add obj @doc.appendChild(obj.doc) end |
#attr(name, value = nil) ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/ie_handler.rb', line 110 def attr name, value=nil unless value @doc.getAttribute(name) else @doc.setAttribute(name, value) end end |
#back ⇒ Object
36 37 38 39 |
# File 'lib/ie_handler.rb', line 36 def back @ie.GoBack wait end |
#click ⇒ Object
92 93 94 95 |
# File 'lib/ie_handler.rb', line 92 def click @doc.click nil wait end |
#close ⇒ Object
41 42 43 |
# File 'lib/ie_handler.rb', line 41 def close @ie.Quit end |
#each {|_self| ... } ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/ie_handler.rb', line 65 def each yield self unless @doc.respond_to?(:each) @doc.each do |d| obj = self.clone obj.ie = @ie obj.doc = d yield obj end end |
#find ⇒ Object
initalization. this is configulation which you should ie.find when you access DOM.
47 48 49 50 51 |
# File 'lib/ie_handler.rb', line 47 def find @doc = @ie.document @start = nil self end |
#go(url, visible = true) ⇒ Object
move to the specified url
30 31 32 33 34 |
# File 'lib/ie_handler.rb', line 30 def go url, visible = true @ie.Navigate(url) @ie.Visible=visible wait end |
#html(content = nil) ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/ie_handler.rb', line 97 def html content=nil if content @doc.appendChild(@ie.document.createTextNode(content)) else @doc.innerHTML end end |
#method(name) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ie_handler.rb', line 125 def method name @ie.ole_method_help(name).params.each do |param| str = "" str.concat "[in] " if param.input? str.concat "[out] " if param.output? str.concat "[optional] " if param.optional? str.concat "[retval] " if param.retval? str.concat param.name str.concat " = #{param.default}" if param.default str.concat " As #{param.ole_type}" puts str end end |
#methods(search_word = nil) ⇒ Object
for inspect methods
119 120 121 122 123 |
# File 'lib/ie_handler.rb', line 119 def methods search_word=nil mtds = @doc.ole_methods.map{|mtd| mtd.to_s}.sort mtds = mtds.grep search_word if search_word mtds end |
#sa ⇒ Object
Saved Access Save ie object ex) save tr and use td using saved tr object.
56 57 58 59 60 61 62 63 |
# File 'lib/ie_handler.rb', line 56 def sa unless @start @start = @doc else @doc = @start end self end |
#wait ⇒ Object
wait during loading
23 24 25 26 27 |
# File 'lib/ie_handler.rb', line 23 def wait while @ie.Busy == true sleep 1 end end |