class Base
Public Class Methods
new(attrs)
click to toggle source
# File lib/mattermost/models/base.rb, line 3 def initialize(attrs) attrs.each do |k,v| singleton_class.class_eval { attr_accessor "#{k}" } instance_variable_set "@#{k.to_sym}", v end end
Public Instance Methods
attributes()
click to toggle source
# File lib/mattermost/models/base.rb, line 10 def attributes return self.class.default_attributes unless defined?(@id) hash = {} self.instance_variables.each do |v| hash[v.to_s.gsub('@', '').to_sym] = instance_variable_get(v) end hash end
first()
click to toggle source
# File lib/mattermost/models/base.rb, line 23 def first eval("Mattermost::#{self.class}").all.first end
last()
click to toggle source
# File lib/mattermost/models/base.rb, line 19 def last eval("Mattermost::#{self.class}").all.last end
to_json()
click to toggle source
# File lib/mattermost/models/base.rb, line 27 def to_json attributes.to_json end