Class: Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childCollectionObject (readonly)

Returns the value of attribute childCollection.



10
11
12
# File 'lib/collection.rb', line 10

def childCollection
  @childCollection
end

#groupObject (readonly)

Returns the value of attribute group.



8
9
10
# File 'lib/collection.rb', line 8

def group
  @group
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/collection.rb', line 6

def name
  @name
end

#ownerObject (readonly)

Returns the value of attribute owner.



7
8
9
# File 'lib/collection.rb', line 7

def owner
  @owner
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



9
10
11
# File 'lib/collection.rb', line 9

def permissions
  @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

#docsObject

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

#documentsObject



23
24
25
# File 'lib/collection.rb', line 23

def documents
  @documents.each { |d| yield d }
end

#to_sObject



19
20
21
# File 'lib/collection.rb', line 19

def to_s()
  return "#{@permissions} #{@owner} #{@group} #{@name}"
end