Masafumi Yokoyama
null+****@clear*****
Sat Nov 1 17:24:23 JST 2014
Masafumi Yokoyama 2014-11-01 17:24:23 +0900 (Sat, 01 Nov 2014) New Revision: 0233a37f377f4624cb17ee347ec4711ec9cdd08a https://github.com/ranguba/rroonga/commit/0233a37f377f4624cb17ee347ec4711ec9cdd08a Message: example: use " (double quote) for string literal Modified files: example/bookmark.rb example/index-html.rb example/search/config.ru Modified: example/bookmark.rb (+5 -5) =================================================================== --- example/bookmark.rb 2014-11-01 16:27:52 +0900 (766e6fd) +++ example/bookmark.rb 2014-11-01 17:24:23 +0900 (d61553d) @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- base_dir = File.join(File.dirname(__FILE__), "..") -groonga_ext_dir = File.join(base_dir, 'ext', 'groonga') -groonga_lib_dir = File.join(base_dir, 'lib') +groonga_ext_dir = File.join(base_dir, "ext", "groonga") +groonga_lib_dir = File.join(base_dir, "lib") $LOAD_PATH.unshift(groonga_ext_dir) $LOAD_PATH.unshift(groonga_lib_dir) @@ -14,7 +14,7 @@ rescue LoadError require "groonga" end -require 'time' +require "time" # Groonga::Logger.register(:level => :debug) do |level, time, title, message, location| # p [level, time, title, message, location] @@ -25,8 +25,8 @@ Groonga::Context.default_options = {:encoding => :utf8} path = ARGV[0] if path.nil? - require 'tmpdir' - require 'fileutils' + require "tmpdir" + require "fileutils" temporary_directory = File.join(Dir.tmpdir, "rroonga") FileUtils.mkdir_p(temporary_directory) at_exit {FileUtils.rm_rf(temporary_directory)} Modified: example/index-html.rb (+6 -6) =================================================================== --- example/index-html.rb 2014-11-01 16:27:52 +0900 (e9cea9f) +++ example/index-html.rb 2014-11-01 17:24:23 +0900 (a8c071e) @@ -5,15 +5,15 @@ if ARGV.size < 2 or ARGV.find {|option| option == "-h" or option == "--help"} exit end -require 'pathname' +require "pathname" base_directory = Pathname(__FILE__).dirname + ".." $LOAD_PATH.unshift((base_directory + "ext").to_s) $LOAD_PATH.unshift((base_directory + "lib").to_s) -require 'rubygems' -require 'groonga' -require 'nokogiri' +require "rubygems" +require "groonga" +require "nokogiri" database_file, *targets = ARGV @@ -71,8 +71,8 @@ targets.each do |target| end html_document.css("img").each do |image| image_content = [] - title = image['title'] - alt = image['alt'] + title = image["title"] + alt = image["alt"] image_content << title if title and !title.empty? image_content << alt if alt and !alt.empty? contents.concat(image_content) unless image_content.empty? Modified: example/search/config.ru (+11 -11) =================================================================== --- example/search/config.ru 2014-11-01 16:27:52 +0900 (8f734cd) +++ example/search/config.ru 2014-11-01 17:24:23 +0900 (0c9dc3b) @@ -4,9 +4,9 @@ base_dir = File.join(File.dirname(__FILE__), "..", "..") $LOAD_PATH.unshift(File.join(base_dir, "ext")) $LOAD_PATH.unshift(File.join(base_dir, "lib")) -require 'rubygems' -require 'rack' -require 'groonga' +require "rubygems" +require "rack" +require "groonga" use Rack::CommonLogger use Rack::Runtime @@ -27,8 +27,8 @@ class Searcher response = Rack::Response.new response["Content-Type"] = "text/html; charset=UTF-8" - if request.post? or request['query'] - query = request['query'] || '' + if request.post? or request["query"] + query = request["query"] || "" if query.empty? request.path_info = "/" else @@ -87,14 +87,14 @@ EOF end def query(request) - unescape(request.path_info.gsub(/\A\/|\/\z/, '')) + unescape(request.path_info.gsub(/\A\/|\/\z/, "")) end def page(request) - (request['page'] || 0).to_i + (request["page"] || 0).to_i end - def path(request, component='') + def path(request, component="") escape_html("#{request.script_name}/#{component}") end @@ -163,9 +163,9 @@ EOS def render_record(request, response, record) response.write(" <div class='record'>\n") - href = escape_html(record['.path']) - title = escape_html(record['.title']) - last_modified = escape_html(record['.last-modified'].iso8601) + href = escape_html(record[".path"]) + title = escape_html(record[".title"]) + last_modified = escape_html(record[".last-modified"].iso8601) score = record.score response.write(" <h2><a href='#{href}'>#{title}</a>(#{score})</h2>\n") render_snippet(request, response, record) -------------- next part -------------- HTML����������������������������... 下載