キャッシュを作成

 @param [Mechanize::Page] result_page Mechanize:Page
 @param [String] number ナンバー
187368
def mkcache(result_page, number)
      mkcache_dir

      @logger.info("Download #{result_page.uri.path}")

      # ランナーデータエラー（存在しない）でもキャッシュを作成する
      if File.basename(result_page.uri.path) == 'number_error.html'
        number_file = File.join(@cache_dir, "#{number}_error.html")
        @agent.download(result_page.uri.path, number_file)
        return nil
      end

      number_file = File.join(@cache_dir, "#{number}.html")
      @agent.download(result_page.uri.path, number_file)
      return result_page
    end
927285
def load_page
      @page ||= Language.current.pages.contentpages.find_by(
        urlname: params[:urlname],
        language_code: params[:locale] || Language.current.code
      )
    end
1165003
def number_of_pages(self, key, value):
    """"""
    result = maybe_int(force_single_element(value.get('a', '')))
    if result and result > 0:
        return result
1329097
function encodeOutputWithPage(output, page) {
    var file = page.getFile();
    var book = output.getBook();

    var result = encodeOutput(output);
    result.page = encodePage(page, book.getSummary());
    result.file = encodeFile(file);

    return result;
}
145200
function PageResult(items, totalCount, requestOffset, requestCount, baseUrl) {
      this.items = items != null ? items : [];
      this.totalCount = totalCount != null ? totalCount : 0;
      this.requestOffset = requestOffset != null ? requestOffset : 0;
      this.requestCount = requestCount != null ? requestCount : 25;
      this.baseUrl = baseUrl != null ? baseUrl : null;
      this.toRest = __bind(this.toRest, this);

      this.directButtons = __bind(this.directButtons, this);

      this.createButton = __bind(this.createButton, this);

      this.prevButton = __bind(this.prevButton, this);

      this.nextButton = __bind(this.nextButton, this);

      this.prevButtonEnabled = __bind(this.prevButtonEnabled, this);

      this.nextButtonEnabled = __bind(this.nextButtonEnabled, this);

      this.currentPageAsString = __bind(this.currentPageAsString, this);

      this.pageToString = __bind(this.pageToString, this);

      this.numberOfPages = __bind(this.numberOfPages, this);

      this.lastPage = __bind(this.lastPage, this);

      this.firstPage = __bind(this.firstPage, this);

      this.currentPage = __bind(this.currentPage, this);

    }
268001
def add_page(url)
      unless robot_txt_allowed?(url)
        @scanned_pages << url
        return nil
      end
      page = Page.new(url)
      @pages << page
      @scanned_pages << url
    end
1208711
def load_result
      if array_or_relation.is_a? Array
        result = array_or_relation[offset..(offset + per_page - 1)]
      else
        result = array_or_relation.limit(per_page).offset(offset).all
      end

      self.replace result.nil? ? [] : result
    end
1008042
def iter_pages_builds(self, number=-1, etag=None):
        
        url = self._build_url('pages', 'builds', base_url=self._api)
        return self._iter(int(number), url, PagesBuild, etag=etag)
449484
function make_page(i, total) {
    var $p = $$('page', {el: 'span'});
    if (i == page) {
      $p.addClass('selected');
      $lp = $p;
    }
    var top = Math.min(i*pagesize+pagesize, total);
    $p.text((i*pagesize+1)+'-'+top);
    $p.text(i+1);
    $p.click(function () {
      page = i;
      zcookie.set('page-'+type, page);
      if ($lp)
        $lp.removeClass('selected');
      $lp = $p;
      $lp.addClass('selected');
      request_data();
    });
    return $p;
  }
985472
def handle_pagination(self, page_num=None, page_size=None):
        
        self._response_json = self.get_next_page(page_num=page_num, page_size=page_size)
        self.update_attrs()
        self.position = 0
        self.values = self.process_page()
1313968
def page(pattern: SCAN_PATTERN, cursor: 0, page_size: 100)
      redis do |conn|
        total_size, digests = conn.multi do
          conn.scard(UNIQUE_SET)
          conn.sscan(UNIQUE_SET, cursor, match: pattern, count: page_size)
        end

        [total_size, digests[0], digests[1]]
      end
    end
1251914
function decodePage(output, page, result) {
    var originalContent = page.getContent();

    // No returned value
    // Existing content will be used
    if (!result) {
        return page;
    }

    deprecate.disable('page.sections');

    // GitBook 3
    // Use returned page.content if different from original content
    if (result.content != originalContent) {
        page = page.set('content', result.content);
    }

    // GitBook 2 compatibility
    // Finally, use page.sections
    else if (result.sections) {
        page = page.set('content',
            result.sections.map(function(section) {
                return section.content;
            }).join('\n')
        );
    }

    deprecate.enable('page.sections');

    return page;
}
90426
def paginate!(curr_page)
      return if !hard_paginate?
      @page = curr_page.to_i
      raise ArgumentError if @page < 1 || @page > total_pages
      adj_page = @page - 1 > 0 ? @page - 1 : 0
      @prev_page = adj_page > 0 ? adj_page : nil
      @next_page = page < total_pages ? (@page + 1) : nil
      @data.only!(adj_page * per_page..(@page * per_page - 1))
    end
1192843
def add_aut_num_result(autnums)
      result = root.result

      @protocols.each do |protocol|
        result[protocol] ||= {}

        Array(autnums).each do |autnum|
          result[protocol][autnum] ||= []
        end
      end
    end
810177
def generate_page_link page_number
      url = core__add_param_to_url(@args[:url], @args[:param], page_number)
      if @args[:extra_params]
        @args[:extra_params].each do |key, value|
          url = core__add_param_to_url(url, key, value)
        end
      end
      url
    end
653894
def _result(number)
      page = page(number)

      # 取得出来ず
      if page.nil?
        return nil
      end

      name = page.at('div#personalBlock/dl/dd').text.sub('： ', '')

      runner = Runner.new(number, name)
      trs = page.search('table.sarchList/tr[@align="center"]')
      trs.each  do |tr|
        tds = tr.xpath('td')
        name, split, lap, pass = tds.map(&:text)
        runner.add_point(name, split, lap, pass)
      end

      return runner
    end
209483
protected void loadPage(int pageNum) {

        int start = (pageNum - 1) * m_pageSize;
        List<CmsResultItemBean> results = m_resultBeans;
        int end = start + m_pageSize;
        if (end > results.size()) {
            end = results.size();
        }
        List<CmsResultItemBean> page = results.subList(start, end);
        boolean showPath = SortParams.path_asc.name().equals(m_searchBean.getSortOrder())
            || SortParams.path_desc.name().equals(m_searchBean.getSortOrder());
        m_resultsTab.addContentItems(page, true, showPath);
    }