Module: Myob::Api::Helpers
- Included in:
- Client
- Defined in:
- lib/myob/api/helpers.rb
Instance Method Summary collapse
Instance Method Details
#model(model_name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/myob/api/helpers.rb', line 19 def model(model_name) method_name = model_name.to_s.underscore variable_name = "@#{method_name}_model".to_sym unless instance_variable_defined?(variable_name) instance_variable_set(variable_name, Myob::Api::Model.const_get("#{model_name}".to_sym).new(self, model_name.to_s)) self.define_singleton_method(method_name.to_sym) do instance_variable_get(variable_name) end end instance_variable_get(variable_name) end |