Method: Arrogance::TagHandler#discover_author_tag
- Defined in:
- lib/arrogance/tools.rb
#discover_author_tag(set, doc) ⇒ Object
– get author_tag
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/arrogance/tools.rb', line 46 def (set, doc) ary = [] set.each do |node| node.children.each do |child| str, class_ary = child.to_s.gsub(/<.*?>/, ''), [] str.split(//).each {|s| class_ary << s.class } unless class_ary.empty? if /<.*?>/.match(child.to_s) && class_ary.mode != Fixnum && str.split(//).length < 20 = ['title', 'total', 'category', 'comments', 'updated', 'id'] tag = /<.*?>/.match(child.to_s).to_s.gsub(/(<|>)/, '').strip.split(' ')[0] #string brutality... unless .include?(tag) ary << tag end end end end unless ary.empty? self. = ary.mode.to_s.gsub(/(<|>)/, '') else if (auth = doc.xpath('//author//name')[0].to_s) && ! auth.empty? self. = '//author//name' else self. = 'none' end end end end |