Class: Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/ttr/objects/entity.rb

Overview

Copyright © 2011 Jesse Sielaff

Direct Known Subclasses

City, Game, Opponent, Player, Route, Ticket

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ Entity

Returns a new instance of Entity.



12
13
14
# File 'lib/ttr/objects/entity.rb', line 12

def initialize (obj)
  @obj = obj
end

Class Method Details

.inherited(klass) ⇒ Object



7
8
9
10
# File 'lib/ttr/objects/entity.rb', line 7

def Entity.inherited (klass)
  klass.define_singleton_method(:object) {|obj| obj.instance_variable_get(:@obj) }
  klass.define_singleton_method(:entities) {|ary| ary.map {|obj| klass.new(obj) } }
end