Module: Elo::Helper

Included in:
Game, Player, Rating
Defined in:
lib/elo/helper.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


3
4
5
# File 'lib/elo/helper.rb', line 3

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#initialize(attributes = {}) ⇒ Object

Every object can be initialized with a hash, almost, but not quite, entirely unlike ActiveRecord.


9
10
11
12
13
14
# File 'lib/elo/helper.rb', line 9

def initialize(attributes = {})
  attributes.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  self.class.all << self
end