Method: CustomMethods#apply_to
- Defined in:
- lib/cloud_connect/client/custom_methods.rb
#apply_to(receiver, client_opts) ⇒ Object
By extending CustomMethods in YourModule, you are able to call YourModule.apply_to(object_or_array) to add YourModule methods to the object or to all objects in the array.
12 13 14 15 16 17 18 19 |
# File 'lib/cloud_connect/client/custom_methods.rb', line 12 def apply_to(receiver, client_opts) case receiver when Array receiver.each{|a| a.extend self; a._client = client_opts[:client]} when Hashie::Mash receiver.extend self; receiver._client = client_opts[:client] end end |