Module: SmsGlobal::Object::Helper

Included in:
Client
Defined in:
lib/sms_global/object/helper.rb

Instance Method Summary collapse

Instance Method Details

#object(object_name, *params) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/sms_global/object/helper.rb', line 4

def object(object_name, *params)
  define_method(object_name) do |argument=nil|
    object = "@#{object_name}_cache".to_sym
    if !instance_variable_defined?(object)
      instance_variable_set(object, SmsGlobal::Object.const_get("#{object_name.to_s.to_camel_case(true)}".to_sym).new(self))
    end
    instance_variable_get(object)
  end
end