Sha256: 4bd41b9e2ee4e2b7714e777a8262bc2afe14e537800d4be34ff32019856c96c7

Contents?: true

Size: 920 Bytes

Versions: 38

Compression:

Stored size: 920 Bytes

Contents

#
# module io/plugin_pstore
# 	default plugin storage implemented by PStore
#
require 'pstore'

module TDiary
	module IO
		module PluginPStore
			# returning storage object
			def plugin_open(conf)
				storage = Pathname(conf.data_path) + 'plugin'
				storage.mkpath
				return storage
			end

			def plugin_close(storage_object)
			end

			def plugin_transaction(storage_object, plugin_name)
				PStore.new(storage_object + "#{plugin_name}.db").transaction do |db|
					# define methods of plugin storage interface
					# PStore has 'delete' method as same function
					def db.get(key)
						self[key]
					end
					def db.set(key, value)
						self[key] = value
					end
					# def db.delete( key )
					#
					# end
					def db.keys
						self.roots
					end

					yield db
				end
			end
		end
	end
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3

Version data entries

38 entries across 28 versions & 1 rubygems

Version Path
tdiary-5.3.0 lib/tdiary/io/plugin_pstore.rb
tdiary-5.2.4 lib/tdiary/io/plugin_pstore.rb
tdiary-5.2.3 lib/tdiary/io/plugin_pstore.rb
tdiary-5.2.2 lib/tdiary/io/plugin_pstore.rb
tdiary-5.2.1 lib/tdiary/io/plugin_pstore.rb
tdiary-5.2.0 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.7 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.6 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.5 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.4 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.3 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.2 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.1 lib/tdiary/io/plugin_pstore.rb
tdiary-5.1.0 lib/tdiary/io/plugin_pstore.rb
tdiary-5.0.14 lib/tdiary/io/plugin_pstore.rb