Class: FifthedSim::StatBlock
- Inherits:
-
Object
- Object
- FifthedSim::StatBlock
- Defined in:
- lib/fifthed_sim/stat_block.rb
Defined Under Namespace
Classes: DefinitionProxy
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ StatBlock
constructor
A new instance of StatBlock.
Constructor Details
#initialize(hash) ⇒ StatBlock
Returns a new instance of StatBlock.
41 42 43 44 45 46 47 48 49 |
# File 'lib/fifthed_sim/stat_block.rb', line 41 def initialize(hash) @hash = Hash[hash.map do |k, v| if v.is_a?(Stat) [k, v] else [k, Stat.new(v)] end end] end |
Class Method Details
.define(&block) ⇒ Object
36 37 38 39 |
# File 'lib/fifthed_sim/stat_block.rb', line 36 def self.define(&block) h = DefinitionProxy.new(&block) self.new(h.hash) end |