Module: TcAdapter::InstanceMethods

Defined in:
lib/models/tc_adapter.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



91
92
93
94
# File 'lib/models/tc_adapter.rb', line 91

def method_missing(meth, *args, &block)
  #cool I just found out * on an array turn the array into a list of args for a function
  @instance.send(meth, *args, &block)
end

Instance Method Details

#errorsObject



83
84
85
# File 'lib/models/tc_adapter.rb', line 83

def errors
  @instance.errors.join(', ')
end

#idObject

this was the only thing that didn’t get passed on to method_missing because this is a method of object doh



97
98
99
# File 'lib/models/tc_adapter.rb', line 97

def id
  @instance.id
end

#update(attributes) ⇒ Object



79
80
81
# File 'lib/models/tc_adapter.rb', line 79

def update(attributes)
  @instance.update attributes
end

#validObject



87
88
89
# File 'lib/models/tc_adapter.rb', line 87

def valid
  @instance.errors.length == 0
end