Sha256: 692c5c2478ea1e1a836171e4a6acd925147b86ef4cba557318ff30d1dc771320

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

module Elo

	module Helper

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

    # Every object can be initialized with a hash,
		# almost, but not quite, entirely unlike ActiveRecord.
    def initialize(attributes = {})
      attributes.each do |key, value|
        instance_variable_set("@#{key}", value)
      end
      self.class.all << self
    end

    module ClassMethods

      # Provides a list of all instantiated objects of the class.
      def all
        @all ||= []
      end

    end

	end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
elo2-0.1.0 lib/elo/helper.rb
elo-0.1.0 lib/elo/helper.rb
elo-0.0.3.alpha lib/elo/helper.rb