Class: Moped::GridFS::Buckets
- Inherits:
-
Object
- Object
- Moped::GridFS::Buckets
- Includes:
- Enumerable
- Defined in:
- lib/moped/gridfs/buckets.rb
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #count ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(session) ⇒ Buckets
constructor
A new instance of Buckets.
- #names ⇒ Object
Constructor Details
#initialize(session) ⇒ Buckets
Returns a new instance of Buckets.
10 11 12 |
# File 'lib/moped/gridfs/buckets.rb', line 10 def initialize(session) @session = session end |
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
8 9 10 |
# File 'lib/moped/gridfs/buckets.rb', line 8 def session @session end |
Instance Method Details
#[](name) ⇒ Object
22 23 24 |
# File 'lib/moped/gridfs/buckets.rb', line 22 def [](name) Bucket.new(session, name) end |
#count ⇒ Object
18 19 20 |
# File 'lib/moped/gridfs/buckets.rb', line 18 def count collections.size end |
#each(&block) ⇒ Object
26 27 28 |
# File 'lib/moped/gridfs/buckets.rb', line 26 def each(&block) names.each { |name| yield(self[name]) } end |
#names ⇒ Object
14 15 16 |
# File 'lib/moped/gridfs/buckets.rb', line 14 def names collections.map { |collection| collection.name.gsub('.files', '') } end |