Class: Husc::CrawlArray
- Inherits:
-
Array
- Object
- Array
- Husc::CrawlArray
- Defined in:
- lib/husc.rb
Overview
特殊配列
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/husc.rb', line 30 def method_missing(method, *args) if self == [] return eval("Husc.new(doc: nil).#{method}(*#{args})") end return eval("self[0].#{method}(*#{args})") end |
Instance Method Details
#find(search) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/husc.rb', line 17 def find(search) ## -----*----- 検索 -----*----- ## self.each do |e| if search.keys[0].to_s == 'inner' # inner_textが一致するか return e if e.inner_text == search.values[0] else # 属性が一致するか return e if e.attr(search.keys[0].to_s) == search.values[0] end end end |