Class: Cain::Hero
Instance Attribute Summary collapse
-
#character_class ⇒ Object
Returns the value of attribute character_class.
-
#dead ⇒ Object
Returns the value of attribute dead.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#hardcore ⇒ Object
Returns the value of attribute hardcore.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#paragon_level ⇒ Object
Returns the value of attribute paragon_level.
Attributes inherited from Model
Class Method Summary collapse
Methods inherited from Model
Constructor Details
This class inherits a constructor from Cain::Model
Instance Attribute Details
#character_class ⇒ Object
Returns the value of attribute character_class.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def character_class @character_class end |
#dead ⇒ Object
Returns the value of attribute dead.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def dead @dead end |
#gender ⇒ Object
Returns the value of attribute gender.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def gender @gender end |
#hardcore ⇒ Object
Returns the value of attribute hardcore.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def hardcore @hardcore end |
#id ⇒ Object
Returns the value of attribute id.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def id @id end |
#level ⇒ Object
Returns the value of attribute level.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def name @name end |
#paragon_level ⇒ Object
Returns the value of attribute paragon_level.
19 20 21 |
# File 'lib/cain/hero.rb', line 19 def paragon_level @paragon_level end |
Class Method Details
.build_from_json(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cain/hero.rb', line 7 def self.build_from_json params hero = new params.keys.each do |key| method = key.gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase method = "character_class" if method == "class" hero.send(method + "=", params[key]) end hero end |