Module: ActsAsLiving::EnumDefiner::ClassMethods

Defined in:
lib/acts_as_living/enum_definer.rb

Instance Method Summary collapse

Instance Method Details

#stages_enumObject



13
14
15
16
# File 'lib/acts_as_living/enum_definer.rb', line 13

def stages_enum
  stages = @stage_keys.map.with_index(&method(:to_enum_map)).to_h
  stages.merge(@death => @spread * -1)
end

#to_enum_map(stage, index) ⇒ Object



18
19
20
# File 'lib/acts_as_living/enum_definer.rb', line 18

def to_enum_map(stage, index)
  [stage, index * @spread]
end