Class: Natural20::Spell
- Inherits:
-
Object
- Object
- Natural20::Spell
- Defined in:
- lib/natural_20/spell_library/spell.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(source, spell_name, details) ⇒ Spell
constructor
A new instance of Spell.
- #label ⇒ Object
- #validate!(_action) ⇒ Object
Constructor Details
#initialize(source, spell_name, details) ⇒ Spell
Returns a new instance of Spell.
5 6 7 8 9 10 |
# File 'lib/natural_20/spell_library/spell.rb', line 5 def initialize(source, spell_name, details) @name = spell_name @properties = details @source = source @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
2 3 4 |
# File 'lib/natural_20/spell_library/spell.rb', line 2 def errors @errors end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
3 4 5 |
# File 'lib/natural_20/spell_library/spell.rb', line 3 def properties @properties end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/natural_20/spell_library/spell.rb', line 3 def source @source end |
Class Method Details
.apply!(battle, item) ⇒ Object
20 |
# File 'lib/natural_20/spell_library/spell.rb', line 20 def self.apply!(battle, item); end |
Instance Method Details
#id ⇒ Object
16 17 18 |
# File 'lib/natural_20/spell_library/spell.rb', line 16 def id @properties[:id] end |
#label ⇒ Object
12 13 14 |
# File 'lib/natural_20/spell_library/spell.rb', line 12 def label t(:"spell.#{@name}") end |
#validate!(_action) ⇒ Object
22 23 24 |
# File 'lib/natural_20/spell_library/spell.rb', line 22 def validate!(_action) @errors.clear end |