Class: Loveseat::Model
- Inherits:
-
Object
- Object
- Loveseat::Model
- Defined in:
- lib/loveseat/model.rb
Direct Known Subclasses
Class Method Summary collapse
- .all ⇒ Object
- .connection=(connection_hash) ⇒ Object
- .database ⇒ Object
- .get(id) ⇒ Object
- .server ⇒ Object
- .setup(options = {}, &block) ⇒ Object
Instance Method Summary collapse
Class Method Details
.all ⇒ Object
26 27 28 |
# File 'lib/loveseat/model.rb', line 26 def self.all Document.all(self.database, self) end |
.connection=(connection_hash) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/loveseat/model.rb', line 3 def self.connection=(connection_hash) @@server = Rest::Server.new(connection_hash[:host], connection_hash[:port], connection_hash[:user], connection_hash[:password]) @@database = Rest::Database.new(@@server, connection_hash[:database]) end |
.database ⇒ Object
38 39 40 |
# File 'lib/loveseat/model.rb', line 38 def self.database @@database end |
.get(id) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/loveseat/model.rb', line 19 def self.get(id) unless id[self.name] id = [self.name, id].join(':') end Document.get(self.database, id) end |
.server ⇒ Object
34 35 36 |
# File 'lib/loveseat/model.rb', line 34 def self.server @@server end |