Class: Dhis2::CollectionWrapper
- Inherits:
-
Object
- Object
- Dhis2::CollectionWrapper
- Defined in:
- lib/dhis2/collection_wrapper.rb
Instance Method Summary collapse
-
#initialize(resource_name, client) ⇒ CollectionWrapper
constructor
A new instance of CollectionWrapper.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name) ⇒ Boolean
Constructor Details
#initialize(resource_name, client) ⇒ CollectionWrapper
Returns a new instance of CollectionWrapper.
5 6 7 8 |
# File 'lib/dhis2/collection_wrapper.rb', line 5 def initialize(resource_name, client) @klass = get_resource_klass(resource_name)[client.version] @client = client end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
10 11 12 13 |
# File 'lib/dhis2/collection_wrapper.rb', line 10 def method_missing(method_name, *args, &block) args = args.unshift(@client) @klass.public_send(method_name, *args, &block) end |
Instance Method Details
#respond_to_missing?(method_name) ⇒ Boolean
15 16 17 |
# File 'lib/dhis2/collection_wrapper.rb', line 15 def respond_to_missing?(method_name) @klass.respond_to? method_name end |