null+****@clear*****
null+****@clear*****
Tue Feb 7 19:48:01 JST 2012
SUZUKI Miho 2012-02-07 19:48:01 +0900 (Tue, 07 Feb 2012) New Revision: b2cbc8200dc5516c3d1559e55f017876bfe92af0 Log: move expression.close and snippet.close to ensure Modified files: lib/logaling/glossary_db.rb Modified: lib/logaling/glossary_db.rb (+15 -10) =================================================================== --- lib/logaling/glossary_db.rb 2012-02-06 18:06:38 +0900 (2d0822e) +++ lib/logaling/glossary_db.rb 2012-02-07 19:48:01 +0900 (fa77cec) @@ -106,7 +106,7 @@ module Logaling snippet = records_selected.expression.snippet(["<snippet>", "</snippet>"], options) snipped_source_term = [] - formatted_records = records.map do |record| + records.map do |record| term = record.key snipped_text = snippet.execute(term.source_term).join {:glossary_name => term.glossary.key, @@ -117,10 +117,10 @@ module Logaling :target_term => term.target_term, :note => term.note || ''} end + ensure snippet.close records_selected.expression.close specified_glossary.expression.close - formatted_records end def translation_list(glossary, source_language, target_language) @@ -136,7 +136,7 @@ module Logaling {:key=>"source_term", :order=>'ascending'}, {:key=>"target_term", :order=>'ascending'}]) - formatted_records = records.map do |record| + records.map do |record| term = record.key {:glossary_name => term.glossary.key, @@ -146,8 +146,8 @@ module Logaling :target_term => term.target_term, :note => term.note || ''} end + ensure records_raw.expression.close - formatted_records end def get_bilingual_pair(source_term, target_term, glossary) @@ -159,7 +159,7 @@ module Logaling ] end - formatted_records = records.map do |record| + records.map do |record| term = record.key {:glossary_name => term.glossary, @@ -169,8 +169,8 @@ module Logaling :target_term => term.target_term, :note => term.note || ''} end + ensure records.expression.close - formatted_records end def get_bilingual_pair_with_note(source_term, target_term, note, glossary) @@ -183,7 +183,7 @@ module Logaling ] end - formatted_records = records.map do |record| + records.map do |record| term = record.key {:glossary_name => term.glossary, @@ -193,8 +193,8 @@ module Logaling :target_term => term.target_term, :note => term.note || ''} end + ensure records.expression.close - formatted_records end def glossary_source_exist?(glossary_source, indexed_at) @@ -204,8 +204,9 @@ module Logaling record.indexed_at == indexed_at ] end - glossary.expression.close !glossary.size.zero? + ensure + glossary.expression.close end def get_all_glossary_source @@ -229,6 +230,7 @@ module Logaling records.each do |record| record.key.delete end + ensure records.expression.close end @@ -244,6 +246,7 @@ module Logaling records.each do |record| record.key.delete end + ensure records.expression.close end @@ -259,6 +262,7 @@ module Logaling records.each do |record| record.key.delete end + ensure records.expression.close end @@ -355,8 +359,9 @@ module Logaling config = record.key config.conf_value end - records.expression.close value.size > 0 ? value[0] : "" + ensure + records.expression.close end def add_config(conf_key, conf_value)