Module: AutotaskRuby::Fields

Defined in:
lib/autotask_ruby/fields.rb

Overview

Converts Autotask Entity Fields into methods.

Instance Method Summary collapse

Instance Method Details

#field(method_name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/autotask_ruby/fields.rb', line 6

def field(method_name)
  inst_variable_name = "@#{method_name}".to_sym
  define_method method_name do
    instance_variable_get inst_variable_name
  end
  define_method "#{method_name}=" do |new_value|
    instance_variable_set inst_variable_name, new_value
  end
end