Sha256: 601b26cebe97088ff3f925356f6e45298620f564e5dbcfa2e2ca5865bcef0af7

Contents?: true

Size: 1.15 KB

Versions: 33

Compression:

Stored size: 1.15 KB

Contents

# -*- coding: utf-8 -*-
#
# Copyright (C) 2013  Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

module Groonga
  # @api private
  class MemoryPool
    def initialize
      @temporary_objects = {}
    end

    def register(object)
      return unless object.temporary?
      return unless object.is_a?(Groonga::Table)
      @temporary_objects[object] = true
    end

    def close
      @temporary_objects.each do |(object, _)|
        object.close unless object.closed?
      end
      @temporary_objects.clear
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
rroonga-4.0.3-x86-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.3-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.3 lib/groonga/memory-pool.rb
rroonga-4.0.2-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.2-x86-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.2 lib/groonga/memory-pool.rb
rroonga-4.0.1-x86-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.1-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.1 lib/groonga/memory-pool.rb
rroonga-4.0.0-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.0-x86-mingw32 lib/groonga/memory-pool.rb
rroonga-4.0.0 lib/groonga/memory-pool.rb
rroonga-3.1.2-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-3.1.2-x86-mingw32 lib/groonga/memory-pool.rb
rroonga-3.1.2 lib/groonga/memory-pool.rb
rroonga-3.1.1-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-3.1.1-x86-mingw32 lib/groonga/memory-pool.rb
rroonga-3.1.1 lib/groonga/memory-pool.rb
rroonga-3.1.0-x64-mingw32 lib/groonga/memory-pool.rb
rroonga-3.1.0-x86-mingw32 lib/groonga/memory-pool.rb