#!/usr/koeki/bin/ruby
# coding: utf-8

require "pstore"
x = PStore.new("word.db")
x.transaction do
  x["word"] = x["word"] || Hash.new	# x["word"] ||= Hash.new でも可
  word = x["word"]

  print "名前は?: "
  name = gets.chomp
  print "ひとこと: 
  word[name] = gets.chomp

  for who, wd in word
    printf("%sさんのひとこと「%s」\n", who, wd)
  end

end
