class Restruct::Structure
Attributes
connection[R]
id[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/restruct/structure.rb, line 6 def initialize(options={}) @connection = options[:connection] || Restruct.connection @id = Id.new options[:id] || Restruct.generate_id end
Public Instance Methods
==(object)
click to toggle source
# File lib/restruct/structure.rb, line 11 def ==(object) object.class == self.class && object.id == id && object.connection == connection end
Also aliased as: eql?
destroy()
click to toggle source
# File lib/restruct/structure.rb, line 27 def destroy connection.lazy 'DEL', id end
dump()
click to toggle source
# File lib/restruct/structure.rb, line 18 def dump connection.call 'DUMP', id end
exists?()
click to toggle source
# File lib/restruct/structure.rb, line 31 def exists? connection.call('EXISTS', id) == 1 end
restore(dump)
click to toggle source
# File lib/restruct/structure.rb, line 22 def restore(dump) destroy connection.lazy 'RESTORE', id, 0, dump end