Sha256: 0dbee5a7e51c3583189824a1e1bd0b610ea429580d4949c96caf9b9b7acd69b4

Contents?: true

Size: 1018 Bytes

Versions: 7

Compression:

Stored size: 1018 Bytes

Contents

# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.

$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'

module Qwik
  class Site
    def index
      return @pages.index
    end

    def isearch(query)
      index = self.index
      return if index.nil?
      return index.search(query)
    end

    def isearch_parse_query(query)
      return query.strip.split
    end
  end
end

if $0 == __FILE__
  require 'qwik/test-common'
  $test = true
end

if defined?($test) && $test
  class TestSiteIndex < Test::Unit::TestCase
    include TestSession

    def test_all
      res = session

      page = @site.create_new
      page.store('This is a test.')
      page = @site.create_new
      page.store('This is a test, too.')

#      ok_eq(['1', '2'], @site.isearch('test'))
#      ok_eq(['2'], @site.isearch('too'))
#      ok_eq([], @site.isearch('nosuch'))
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
qwik2md-2.0.1 vendor/qwik/lib/qwik/site-index.rb
qwik2md-2.0.0 vendor/qwik/lib/qwik/site-index.rb
qwik2md-1.0.2 vendor/qwik/lib/qwik/site-index.rb
qwik2md-1.0.1 vendor/qwik/lib/qwik/site-index.rb
qwik2md-1.0.0 vendor/qwik/lib/qwik/site-index.rb
qwik2md-0.1.0 vendor/qwik/lib/qwik/site-index.rb
qwikdoc-0.0.1 vendor/qwik/site-index.rb