Class: Luca::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/luca/collection.rb,
lib/luca/collection/endpoint.rb,
lib/luca/collection/file_backend.rb,
lib/luca/collection/redis_backend.rb

Defined Under Namespace

Classes: Endpoint, FileBackend, RedisBackend

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Collection

Returns a new instance of Collection.



13
14
15
16
17
18
19
# File 'lib/luca/collection.rb', line 13

def initialize options={}
  @options    = options.dup
  @backend    = options[:backend]
  @namespace  = options[:namespace]

  setup_backend
end

Instance Attribute Details

#backendObject

Returns the value of attribute backend.



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

def backend
  @backend
end

#namespaceObject

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#create(hash = {}) ⇒ Object



29
30
31
# File 'lib/luca/collection.rb', line 29

def create hash={}
  backend.create(hash)
end

#destroy(id) ⇒ Object



41
42
43
# File 'lib/luca/collection.rb', line 41

def destroy id
  backend.destroy(id)
end

#indexObject



25
26
27
# File 'lib/luca/collection.rb', line 25

def index
  backend.index
end

#show(id) ⇒ Object



37
38
39
# File 'lib/luca/collection.rb', line 37

def show id
  backend.show(id)
end

#sync(method, hash = {}, options = {}) ⇒ Object



21
22
23
# File 'lib/luca/collection.rb', line 21

def sync method, hash={}, options={}
  backend.sync(method, hash, options)
end

#update(hash = {}) ⇒ Object



33
34
35
# File 'lib/luca/collection.rb', line 33

def update hash={}
  backend.update(hash)
end