Class: PfrpgImport::HeroclassImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/pfrpg_import/heroclass_importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, path = nil) ⇒ HeroclassImporter

Returns a new instance of HeroclassImporter.



7
8
9
10
11
12
13
14
# File 'lib/pfrpg_import/heroclass_importer.rb', line 7

def initialize(filename, path=nil)
  @csv = CSV.read(filename)
  @path = path
  parser = HeroclassParser.new(@csv)
  @levels = parser.levels
  @facts = parser.facts
  @spells = parser.spells
end

Instance Attribute Details

#factsObject (readonly)

Returns the value of attribute facts.



6
7
8
# File 'lib/pfrpg_import/heroclass_importer.rb', line 6

def facts
  @facts
end

#levelsObject (readonly)

Returns the value of attribute levels.



6
7
8
# File 'lib/pfrpg_import/heroclass_importer.rb', line 6

def levels
  @levels
end

#spellsObject (readonly)

Returns the value of attribute spells.



6
7
8
# File 'lib/pfrpg_import/heroclass_importer.rb', line 6

def spells
  @spells
end

Instance Method Details

#import_heroclassObject



16
17
18
19
20
21
# File 'lib/pfrpg_import/heroclass_importer.rb', line 16

def import_heroclass
  write_level_table
  write_heroclass_file
  write_feature_file
  write_spell_file
end

#write_feature_fileObject



33
34
35
36
# File 'lib/pfrpg_import/heroclass_importer.rb', line 33

def write_feature_file
  feature = FeatureWriter.new(@facts, @facts.title, @path)
  feature.print_features
end

#write_heroclass_fileObject



28
29
30
31
# File 'lib/pfrpg_import/heroclass_importer.rb', line 28

def write_heroclass_file
  heroclass = HeroclassWriter.new(@facts, @facts.title, @path)
  heroclass.print_class
end

#write_level_tableObject



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

def write_level_table
  table = LevelWriter.new(@levels, @facts.title, @path)
  table.print_class
end

#write_spell_fileObject



38
39
40
41
# File 'lib/pfrpg_import/heroclass_importer.rb', line 38

def write_spell_file
  spell = SpellWriter.new(@spells, @facts.title, @path)
  spell.print_spells
end