Class: Common::Common
- Inherits:
-
Object
- Object
- Common::Common
- Defined in:
- lib/spider_rails/common/common.rb
Instance Method Summary collapse
Instance Method Details
#get_content(element, selector, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/spider_rails/common/common.rb', line 3 def get_content(element, selector, &block) begin if block_given? element.css(selector).each &block else element.css(selector).each do |e| if e.content != 0 #Just get first element return e.content end end end end end |