Common methods for Elo classes.
Public class methods
included
(base)
[show source]
# File lib/elo.rb, line 98 def self.included(base) base.extend ClassMethods end
new
(attributes)
Every object can be initialized with a hash, just like in ActiveRecord.
[show source]
# File lib/elo.rb, line 103 def initialize(attributes) @attributes == attributes.keys attributes.each do |key, value| self.class.attr_reader key instance_variable_set("@#{key}", value) end self.class.all << self end
Public instance methods
attributes
()
Get a hash of all attributes provided
[show source]
# File lib/elo.rb, line 113 def attributes hash = {} @attributes.each do |attribute| hash.update attribute => send(attribute) end hash end