Class: PfrpgImport::HeroclassParser

Inherits:
Object
  • Object
show all
Includes:
CaseHelpers
Defined in:
lib/pfrpg_import/heroclass_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CaseHelpers

#arrayify, #camelized_title, #underscored_title

Constructor Details

#initialize(csv) ⇒ HeroclassParser

Returns a new instance of HeroclassParser.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pfrpg_import/heroclass_parser.rb', line 5

def initialize(csv)
  factbundle = {
      heroclass_name: csv[0][1],
      description:    csv[1][1],
      class_skills:   csv[2][1],
      alignment:      csv[3][1],
      starting_wealth:csv[4][1],
      hit_die:        csv[5][1],
      skills_per:     csv[6][1],
      spell_mod:      csv[7][1],
      starting_feats: csv[8][1]
  }

  @facts = HeroclassFacts.new(factbundle)
  @levels = HeroclassLevels.new(csv[11..30]).levels
  @spells = HeroclassSpells.new(csv[11..30]).spells
  @filename_prefix = parse_filename
end

Instance Attribute Details

#factsObject (readonly)

Returns the value of attribute facts.



4
5
6
# File 'lib/pfrpg_import/heroclass_parser.rb', line 4

def facts
  @facts
end

#filename_prefixObject (readonly)

Returns the value of attribute filename_prefix.



4
5
6
# File 'lib/pfrpg_import/heroclass_parser.rb', line 4

def filename_prefix
  @filename_prefix
end

#levelsObject (readonly)

Returns the value of attribute levels.



4
5
6
# File 'lib/pfrpg_import/heroclass_parser.rb', line 4

def levels
  @levels
end

#spellsObject (readonly)

Returns the value of attribute spells.



4
5
6
# File 'lib/pfrpg_import/heroclass_parser.rb', line 4

def spells
  @spells
end

Instance Method Details

#parse_filenameObject



24
25
26
# File 'lib/pfrpg_import/heroclass_parser.rb', line 24

def parse_filename
  underscored_title(@facts.friendly_name)
end