Method: Bugly::BuglyObject#method_missing

Defined in:
lib/bugly.rb

#method_missing(name, *args) ⇒ Object (protected)



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/bugly.rb', line 262

def method_missing(name, *args)
  # TODO: only allow setting in updateable classes.
  if name.to_s.end_with?('=')
    attr = name.to_s[0...-1].to_sym
    @values[attr] = args[0]
    @unsaved_values.add(attr)
    add_accessors([attr])
    return
  else
    return @values[name] if @values.has_key?(name)
  end

  begin
    super
  rescue NoMethodError => e
    if @transient_values.include?(name)
      raise NoMethodError.new(e.message + ". HINT: The '#{name}' attribute was set in the past, however. It was then wiped when refreshing the object with the result returned by Bugly's API, probably as a result of a save(). The attributes currently available on this object are: #{@values.keys.join(', ')}")
    else
      raise
    end
  end
end