Class: Collection
- Inherits:
-
Object
- Object
- Collection
- Defined in:
- lib/collection.rb
Instance Attribute Summary collapse
-
#childCollection ⇒ Object
readonly
Returns the value of attribute childCollection.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#docs ⇒ Object
returns string array of all documents in collection.
- #documents ⇒ Object
-
#initialize(client, collectionName) ⇒ Collection
constructor
A new instance of Collection.
- #to_s ⇒ Object
Constructor Details
#initialize(client, collectionName) ⇒ Collection
Returns a new instance of Collection.
12 13 14 15 16 17 |
# File 'lib/collection.rb', line 12 def initialize(client, collectionName) @client = client load(collectionName) rescue => e raise e end |
Instance Attribute Details
#childCollection ⇒ Object (readonly)
Returns the value of attribute childCollection.
10 11 12 |
# File 'lib/collection.rb', line 10 def childCollection @childCollection end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
8 9 10 |
# File 'lib/collection.rb', line 8 def group @group end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/collection.rb', line 6 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
7 8 9 |
# File 'lib/collection.rb', line 7 def owner @owner end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
9 10 11 |
# File 'lib/collection.rb', line 9 def @permissions end |
Instance Method Details
#[](key) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/collection.rb', line 33 def [](key) @documents.each { |d| return d if key == d.name } return nil end |
#docs ⇒ Object
returns string array of all documents in collection
27 28 29 30 31 |
# File 'lib/collection.rb', line 27 def docs #returns string array of all documents in collection ds = [] @documents.each{ |d| ds.push(d.name)} return ds end |
#documents ⇒ Object
23 24 25 |
# File 'lib/collection.rb', line 23 def documents @documents.each { |d| yield d } end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/collection.rb', line 19 def to_s() return "#{@permissions} #{@owner} #{@group} #{@name}" end |