stdlib/pstore/0/pstore.rbs in rbs-2.0.0 vs stdlib/pstore/0/pstore.rbs in rbs-2.1.0

- old
+ new

@@ -1,5 +1,6 @@ +# <!-- rdoc-file=lib/pstore.rb --> # PStore implements a file based persistence mechanism based on a Hash. User # code can store hierarchies of Ruby objects (values) into the data store file # by name (keys). An object hierarchy may be just a single object. User code # may later read values back from the data store or even update data, as needed. # @@ -80,18 +81,26 @@ # backup the PStore files from time to time. # class PStore public + # <!-- + # rdoc-file=lib/pstore.rb + # - [](name) + # --> # Retrieves a value from the PStore file data, by *name*. The hierarchy of Ruby # objects stored under that root *name* will be returned. # # **WARNING**: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # def []: (untyped name) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - []=(name, value) + # --> # Stores an individual Ruby object or a hierarchy of Ruby objects in the data # store file under the root *name*. Assigning to a *name* already in the data # store clobbers the old data. # # ## Example: @@ -109,10 +118,14 @@ # **WARNING**: This method is only valid in a PStore#transaction and it cannot # be read-only. It will raise PStore::Error if called at any other time. # def []=: (untyped name, untyped value) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - abort() + # --> # Ends the current PStore#transaction, discarding any changes to the data store. # # ## Example: # # require "pstore" @@ -130,10 +143,14 @@ # **WARNING**: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # def abort: () -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - commit() + # --> # Ends the current PStore#transaction, committing any changes to the data store # immediately. # # ## Example: # @@ -153,45 +170,69 @@ # **WARNING**: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # def commit: () -> nil + # <!-- + # rdoc-file=lib/pstore.rb + # - delete(name) + # --> # Removes an object hierarchy from the data store, by *name*. # # **WARNING**: This method is only valid in a PStore#transaction and it cannot # be read-only. It will raise PStore::Error if called at any other time. # def delete: (untyped name) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - fetch(name, default=PStore::Error) + # --> # This method is just like PStore#[], save that you may also provide a *default* # value for the object. In the event the specified *name* is not found in the # data store, your *default* will be returned instead. If you do not specify a # default, PStore::Error will be raised if the object is not found. # # **WARNING**: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # def fetch: (untyped name, ?untyped default) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - path() + # --> # Returns the path to the data store file. # def path: () -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - root?(name) + # --> # Returns true if the supplied *name* is currently in the data store. # # **WARNING**: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # def root?: (untyped name) -> bool + # <!-- + # rdoc-file=lib/pstore.rb + # - roots() + # --> # Returns the names of all object hierarchies currently in the store. # # **WARNING**: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # def roots: () -> Array[untyped] + # <!-- + # rdoc-file=lib/pstore.rb + # - transaction(read_only = false) { |pstore| ... } + # --> # Opens a new transaction for the data store. Code executed inside a block # passed to this method may read and write data to and from the data store file. # # At the end of the block, changes are committed to the data store # automatically. You may exit the transaction early with a call to either @@ -205,10 +246,11 @@ # # Note that PStore does not support nested transactions. # def transaction: (?untyped read_only) -> untyped + # <!-- rdoc-file=lib/pstore.rb --> # Whether PStore should do its best to prevent file corruptions, even when under # unlikely-to-occur error conditions such as out-of-space conditions and other # unusual OS filesystem errors. Setting this flag comes at the price in the form # of a performance loss. # @@ -216,60 +258,120 @@ # all POSIX platforms: Linux, MacOS X, FreeBSD, etc). The default value is # false. # def ultra_safe: () -> untyped + # <!-- rdoc-file=lib/pstore.rb --> + # Whether PStore should do its best to prevent file corruptions, even when under + # unlikely-to-occur error conditions such as out-of-space conditions and other + # unusual OS filesystem errors. Setting this flag comes at the price in the form + # of a performance loss. + # + # This flag only has effect on platforms on which file renames are atomic (e.g. + # all POSIX platforms: Linux, MacOS X, FreeBSD, etc). The default value is + # false. + # def ultra_safe=: (untyped) -> untyped private def dump: (untyped table) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - empty_marshal_checksum() + # --> + # def empty_marshal_checksum: () -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - empty_marshal_data() + # --> + # def empty_marshal_data: () -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - in_transaction() + # --> # Raises PStore::Error if the calling code is not in a PStore#transaction. # def in_transaction: () -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - in_transaction_wr() + # --> # Raises PStore::Error if the calling code is not in a PStore#transaction or if # the code is in a read-only PStore#transaction. # def in_transaction_wr: () -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - new(file, thread_safe = false) + # --> # To construct a PStore object, pass in the *file* path where you would like the # data to be stored. # # PStore objects are always reentrant. But if *thread_safe* is set to true, then # it will become thread-safe at the cost of a minor performance hit. # def initialize: (untyped file, ?boolish thread_safe) -> untyped def load: (untyped content) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - load_data(file, read_only) + # --> # Load the given PStore file. If `read_only` is true, the unmarshalled Hash will # be returned. If `read_only` is false, a 3-tuple will be returned: the # unmarshalled Hash, a checksum of the data, and the size of the data. # def load_data: (untyped file, untyped read_only) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - on_windows?() + # --> + # def on_windows?: () -> bool + # <!-- + # rdoc-file=lib/pstore.rb + # - open_and_lock_file(filename, read_only) + # --> # Open the specified filename (either in read-only mode or in read-write mode) # and lock it for reading or writing. # # The opened File object will be returned. If *read_only* is true, and the file # does not exist, then nil will be returned. # # All exceptions are propagated. # def open_and_lock_file: (untyped filename, untyped read_only) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - save_data(original_checksum, original_file_size, file) + # --> + # def save_data: (untyped original_checksum, untyped original_file_size, untyped file) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - save_data_with_atomic_file_rename_strategy(data, file) + # --> + # def save_data_with_atomic_file_rename_strategy: (untyped data, untyped file) -> untyped + # <!-- + # rdoc-file=lib/pstore.rb + # - save_data_with_fast_strategy(data, file) + # --> + # def save_data_with_fast_strategy: (untyped data, untyped file) -> untyped end PStore::EMPTY_MARSHAL_CHECKSUM: String