Class: Taskrabbit::Proxy
Constant Summary
collapse
- COLLECTION_DELEGATE =
%w{first last count size length each keys links}.freeze
Instance Method Summary
collapse
Constructor Details
#initialize(api, target) ⇒ Proxy
Returns a new instance of Proxy.
10
11
12
13
14
|
# File 'lib/taskrabbit/proxy.rb', line 10
def initialize(api, target)
@api = api
@target = target
@opts = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
52
53
54
|
# File 'lib/taskrabbit/proxy.rb', line 52
def method_missing(method, *args, &block)
@target.send(method, *args, &block)
end
|
Instance Method Details
#all(options = {}) ⇒ Object
16
17
18
|
# File 'lib/taskrabbit/proxy.rb', line 16
def all(options = {})
proxy_found(options)
end
|
#create(args) ⇒ Object
36
37
38
|
# File 'lib/taskrabbit/proxy.rb', line 36
def create(args)
@target.create(@api, args) if @target.respond_to?(:create)
end
|
#find(param, options = {}) ⇒ Object
24
25
26
27
28
|
# File 'lib/taskrabbit/proxy.rb', line 24
def find(param, options={})
return all(options) if param == :all
return @target.find(@api, param) if @target.respond_to?(:find)
nil
end
|
#new(options = {}) ⇒ Object
20
21
22
|
# File 'lib/taskrabbit/proxy.rb', line 20
def new(options = {})
@target.new(options, @api)
end
|