Class: PfrpgReaders::PFRPGCharacter
- Inherits:
-
Object
- Object
- PfrpgReaders::PFRPGCharacter
- Defined in:
- lib/pfrpg_readers/pfrpg_character.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#avatar ⇒ Object
readonly
Returns the value of attribute avatar.
-
#character ⇒ Object
readonly
Returns the value of attribute character.
-
#combat ⇒ Object
readonly
Returns the value of attribute combat.
-
#feats ⇒ Object
readonly
Returns the value of attribute feats.
-
#inventory ⇒ Object
readonly
Returns the value of attribute inventory.
-
#misc ⇒ Object
readonly
Returns the value of attribute misc.
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
-
#spells ⇒ Object
readonly
Returns the value of attribute spells.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
- #find_by_id(id) ⇒ Object
-
#initialize(character) ⇒ PFRPGCharacter
constructor
A new instance of PFRPGCharacter.
Constructor Details
#initialize(character) ⇒ PFRPGCharacter
Returns a new instance of PFRPGCharacter.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 6 def initialize(character) @character = character @attributes = AttributesReader.new(character) @demographics = DemographicsReader.new(character) @combat = CombatReader.new(character) @saves = SavesReader.new(character) @misc = MiscReader.new(character) @skills = SkillsReader.new(character) @inventory = InventoryReader.new(character) @spells = SpellsReader.new(character) @avatar = character.avatar if character.respond_to? 'avatar' end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def attributes @attributes end |
#avatar ⇒ Object (readonly)
Returns the value of attribute avatar.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def avatar @avatar end |
#character ⇒ Object (readonly)
Returns the value of attribute character.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def character @character end |
#combat ⇒ Object (readonly)
Returns the value of attribute combat.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def combat @combat end |
#feats ⇒ Object (readonly)
Returns the value of attribute feats.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def feats @feats end |
#inventory ⇒ Object (readonly)
Returns the value of attribute inventory.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def inventory @inventory end |
#misc ⇒ Object (readonly)
Returns the value of attribute misc.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def misc @misc end |
#skills ⇒ Object (readonly)
Returns the value of attribute skills.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def skills @skills end |
#spells ⇒ Object (readonly)
Returns the value of attribute spells.
3 4 5 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 3 def spells @spells end |
Instance Method Details
#as_json(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 19 def as_json(={}) p = { :id => @character.id, :uuid => @character.uuid, :character => @character, :demographics => @demographics, :attributes => @attributes, :combat => @combat, :saves => @saves, :misc => @misc, :skills => @skills, :spells => @spells, :inventory => @inventory } p[:avatar] = AvatarURL.new(@avatar) if @avatar p end |
#find_by_id(id) ⇒ Object
37 38 39 |
# File 'lib/pfrpg_readers/pfrpg_character.rb', line 37 def find_by_id(id) Character.find(id) end |