fantasdic r392 - in trunk: . lib/fantasdic lib/fantasdic/sources
- From: mblondel svn gnome org
- To: svn-commits-list gnome org
- Subject: fantasdic r392 - in trunk: . lib/fantasdic lib/fantasdic/sources
- Date: Mon, 2 Feb 2009 23:40:24 +0000 (UTC)
Author: mblondel
Date: Mon Feb 2 23:40:24 2009
New Revision: 392
URL: http://svn.gnome.org/viewvc/fantasdic?rev=392&view=rev
Log:
* lib/fantasdic/dictzip.rb: Added Dictzip#path.
* lib/fantasdic/sources/dictd_file.rb: Handles the case when a match is
found in the index but the definition can't be reached in the dictionary.
Modified:
trunk/ChangeLog
trunk/lib/fantasdic/dictzip.rb
trunk/lib/fantasdic/sources/dictd_file.rb
Modified: trunk/lib/fantasdic/dictzip.rb
==============================================================================
--- trunk/lib/fantasdic/dictzip.rb (original)
+++ trunk/lib/fantasdic/dictzip.rb Mon Feb 2 23:40:24 2009
@@ -85,6 +85,10 @@
@pos = 0
end
+ def path
+ @file.path
+ end
+
def close
@file.close
end
Modified: trunk/lib/fantasdic/sources/dictd_file.rb
==============================================================================
--- trunk/lib/fantasdic/sources/dictd_file.rb (original)
+++ trunk/lib/fantasdic/sources/dictd_file.rb Mon Feb 2 23:40:24 2009
@@ -220,7 +220,18 @@
index_file.match_exact(word).map do |match, offset, len|
defi = Definition.new
defi.word = match
- defi.body = get_definition(dict_file, offset, len).strip
+
+ body = get_definition(dict_file, offset, len)
+ if body
+ defi.body = body.strip
+ else
+ msg = "Match exists in index file %s "
+ msg += "(offset: %d, len: %d) "
+ msg += "but could not be reach in dictionary %s."
+ msg = msg % [index_file.path, offset, len, dict_file.path]
+ defi.body = msg
+ end
+
defi.database = db
defi.description = db_capitalize
defi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]