Class: MongoBrowser::Models::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_browser/models/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db_name, collection_name, mongo_document) ⇒ Document

Returns a new instance of Document.



7
8
9
10
11
12
# File 'lib/mongo_browser/models/document.rb', line 7

def initialize(db_name, collection_name, mongo_document)
  @db_name = db_name
  @collection_name = collection_name

  @mongo_document = mongo_document
end

Instance Attribute Details

#collection_nameObject (readonly)

Returns the value of attribute collection_name.



4
5
6
# File 'lib/mongo_browser/models/document.rb', line 4

def collection_name
  @collection_name
end

#db_nameObject (readonly)

Returns the value of attribute db_name.



4
5
6
# File 'lib/mongo_browser/models/document.rb', line 4

def db_name
  @db_name
end

#mongo_documentObject (readonly) Also known as: data

Returns the value of attribute mongo_document.



5
6
7
# File 'lib/mongo_browser/models/document.rb', line 5

def mongo_document
  @mongo_document
end

Instance Method Details

#idObject



14
15
16
# File 'lib/mongo_browser/models/document.rb', line 14

def id
  mongo_document["_id"]
end