Class: Stattr::StatList

Inherits:
Object
  • Object
show all
Defined in:
lib/stattr.rb

Overview

Represents the list of Statistics that a player has.

Instance Method Summary collapse

Constructor Details

#initializeStatList

Creates a new StatList object. each stat in STAT is an attribute, with the result of makestat assigned to it



105
106
107
# File 'lib/stattr.rb', line 105

def initialize
   Game.stats.each { |s| instance_variable_set("@#{s}", Game.make_stat) }
end

Instance Method Details

#set_stat(stat, value) ⇒ Object

Allow manual setting of stats.

Parameters:

  • stat (Attribute)
  • val (Integer)


114
115
116
# File 'lib/stattr.rb', line 114

def set_stat(stat, value)
  send "#{stat}=", Stat.new(value)
end