class ActiveGroonga::Database
Public Class Methods
new(path)
click to toggle source
# File lib/active_groonga/database.rb, line 20 def initialize(path) @path = path @database = nil end
Public Instance Methods
close()
click to toggle source
# File lib/active_groonga/database.rb, line 44 def close return if @database.nil? @database.close @database = nil end
ensure_available()
click to toggle source
# File lib/active_groonga/database.rb, line 25 def ensure_available return if @database if @path.exist? @database = Groonga::Database.open(@path.to_s, :context => Base.context) else FileUtils.mkdir_p(@path.dirname) unless @path.dirname.exist? @database = Groonga::Database.create(:path => @path.to_s, :context => Base.context) end end
remove()
click to toggle source
# File lib/active_groonga/database.rb, line 37 def remove ensure_available if @path.exist? return if @database.nil? @database.remove @database = nil end
reopen()
click to toggle source
# File lib/active_groonga/database.rb, line 50 def reopen close ensure_available end