class Ruboty::YMCrawl::Selector

CSSセレクタを表すクラス

Public Class Methods

new(css) click to toggle source
# File lib/ruboty/ymcrawl/crawler.rb, line 19
def initialize(css)
        @selector = css
end

Public Instance Methods

get_last_tag() click to toggle source

セレクタの一番最後のタグが何かを返す。擬似クラスなどは取り除く

# File lib/ruboty/ymcrawl/crawler.rb, line 26
def get_last_tag
        # 一番最後の要素だけを返す。(擬似クラスなどは省く)
        @selector.split(/\s|\+|>/).last.split(/:|,|\[|\.|#/).first
end
to_s() click to toggle source
# File lib/ruboty/ymcrawl/crawler.rb, line 23
def to_s ;@selector end