module NicoQuery::Crawler::TagSearch

Public Class Methods

each_movie(parsed_movies, &block) click to toggle source
# File lib/nicoquery/crawler/tag_search.rb, line 32
def each_movie(parsed_movies, &block)
  while parsed_movies.length > 0 do
    block.call parsed_movies.shift
  end
end
execute(tag: tag, sort: sort, order: order, &block) click to toggle source
# File lib/nicoquery/crawler/tag_search.rb, line 10
def execute(tag: tag, sort: sort, order: order, &block)
  page = 0

  loop do
    command = nil
    page += 1

    tag_search_object = NicoQuery::Object::TagSearch.new tag: tag, sort: sort, order: order, page: page
    self.each_movie(tag_search_object.movies) do |movie|
      command = block.call movie
      break if command == :break || command != :continue
    end

    break if command == :break || command != :continue
  end
end

Private Instance Methods

continue() click to toggle source
# File lib/nicoquery/crawler/tag_search.rb, line 29
def continue; :continue end
each_movie(parsed_movies, &block) click to toggle source
# File lib/nicoquery/crawler/tag_search.rb, line 32
def each_movie(parsed_movies, &block)
  while parsed_movies.length > 0 do
    block.call parsed_movies.shift
  end
end
execute(tag: tag, sort: sort, order: order, &block) click to toggle source
# File lib/nicoquery/crawler/tag_search.rb, line 10
def execute(tag: tag, sort: sort, order: order, &block)
  page = 0

  loop do
    command = nil
    page += 1

    tag_search_object = NicoQuery::Object::TagSearch.new tag: tag, sort: sort, order: order, page: page
    self.each_movie(tag_search_object.movies) do |movie|
      command = block.call movie
      break if command == :break || command != :continue
    end

    break if command == :break || command != :continue
  end
end
stop() click to toggle source
# File lib/nicoquery/crawler/tag_search.rb, line 30
def stop; :stop end