lib/groovy.rb in groovy-0.3.0 vs lib/groovy.rb in groovy-0.4.0

- old
+ new

@@ -14,22 +14,22 @@ end def [](name) contexts[name.to_sym] end - + def first_context_name contexts.keys.first end def open(db_path, name = :default, opts = {}) unless db_path.is_a?(String) - raise ArgumentError, "Invalid db_path: #{db_path}" + raise ArgumentError, "Invalid db_path: #{db_path}" end if contexts[name.to_sym] - raise ArgumentError, "Context already defined: #{name}" + raise ArgumentError, "Context already defined: #{name}" end contexts[name.to_sym] = if name == :default Groonga::Context.default.tap { |ctx| open_or_create_db(ctx, db_path) } else @@ -38,10 +38,10 @@ end def close(name = :default) ctx = contexts[name.to_sym] or raise ContextNotFound.new(name) contexts.delete(name.to_sym) - ctx.close + ctx.close rescue Groonga::Closed => e raise ContextAlreadyClosed end def logger=(obj)