Class: CouchReplicate
- Inherits:
-
Object
- Object
- CouchReplicate
- Defined in:
- lib/couch-replicate-helper.rb
Instance Method Summary collapse
-
#initialize(database) ⇒ CouchReplicate
constructor
database = ‘127.0.0.1:5984/dbname’.
-
#replicate(source, dest) ⇒ Object
name with suffix, suffix.
Constructor Details
#initialize(database) ⇒ CouchReplicate
database = ‘127.0.0.1:5984/dbname’
5 6 7 |
# File 'lib/couch-replicate-helper.rb', line 5 def initialize(database) @db = CouchRest.database(database) end |
Instance Method Details
#replicate(source, dest) ⇒ Object
name with suffix, suffix
10 11 12 13 14 15 16 |
# File 'lib/couch-replicate-helper.rb', line 10 def replicate(source, dest) puts "going to replicate #{source} to dest #{dest}" unless is_active? source, dest puts "triggering replication..." RestClient.post @db.host + '/_replicate', {:source => source, :target => dest, :continuous => true }.to_json, :content_type => "Content-Type: application/json" end end |