Class: Lumberjack::Device::Couchdb
- Inherits:
-
Lumberjack::Device
- Object
- Lumberjack::Device
- Lumberjack::Device::Couchdb
- Defined in:
- lib/lumberjack/couchdb.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
Instance Method Summary collapse
-
#initialize(url, options = {}) ⇒ Couchdb
constructor
A new instance of Couchdb.
- #write(entry) ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Couchdb
Returns a new instance of Couchdb.
10 11 12 13 |
# File 'lib/lumberjack/couchdb.rb', line 10 def initialize(url, = {}) server = CouchRest.new(url) @db = server.database!([:db]) end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
8 9 10 |
# File 'lib/lumberjack/couchdb.rb', line 8 def db @db end |
Instance Method Details
#write(entry) ⇒ Object
15 16 17 18 19 |
# File 'lib/lumberjack/couchdb.rb', line 15 def write(entry) hash = entry.instance_variables.mash {|v| [v[1..-1],entry.instance_variable_get(v)]} hash[:milisec] = Time.new.to_i @db.save_doc(hash) end |